mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-05 23:34:19 -04:00
Use ctx.JSON in Person response to make code cleaner
This commit is contained in:
parent
e5ed91d986
commit
95aad98897
@ -84,19 +84,9 @@ func Person(ctx *context.APIContext) {
|
|||||||
ctx.Error(http.StatusInternalServerError, "Unmarshal", err)
|
ctx.Error(http.StatusInternalServerError, "Unmarshal", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonmap["@context"] = []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"}
|
jsonmap["@context"] = []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"}
|
||||||
|
ctx.JSON(http.StatusOK, jsonmap)
|
||||||
ctx.Resp.Header().Add("Content-Type", "application/activity+json")
|
ctx.Resp.Header().Set("Content-Type", activitypub.ActivityStreamsContentType)
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PersonInbox function
|
// PersonInbox function
|
||||||
|
Loading…
Reference in New Issue
Block a user