Skip to content

Commit

Permalink
Use ctx.JSON in Person response to make code cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Wang committed Jun 16, 2022
1 parent e5ed91d commit 95aad98
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions routers/api/v1/activitypub/person.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,9 @@ func Person(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "Unmarshal", err)
return
}

jsonmap["@context"] = []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"}

ctx.Resp.Header().Add("Content-Type", "application/activity+json")
ctx.Resp.WriteHeader(http.StatusOK)
binary, err = json.Marshal(jsonmap)
if err != nil {
ctx.Error(http.StatusInternalServerError, "Marshal", err)
return
}
if _, err = ctx.Resp.Write(binary); err != nil {
log.Error("write to resp err: %v", err)
}
ctx.JSON(http.StatusOK, jsonmap)
ctx.Resp.Header().Set("Content-Type", activitypub.ActivityStreamsContentType)
}

// PersonInbox function
Expand Down

0 comments on commit 95aad98

Please sign in to comment.