diff options
Diffstat (limited to 'internal/api/wellknown/webfinger/webfingerget.go')
-rw-r--r-- | internal/api/wellknown/webfinger/webfingerget.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/internal/api/wellknown/webfinger/webfingerget.go b/internal/api/wellknown/webfinger/webfingerget.go index 02f366ea6..74cb8fefe 100644 --- a/internal/api/wellknown/webfinger/webfingerget.go +++ b/internal/api/wellknown/webfinger/webfingerget.go @@ -18,7 +18,6 @@ package webfinger import ( - "encoding/json" "errors" "fmt" "net/http" @@ -87,13 +86,12 @@ func (m *Module) WebfingerGETRequest(c *gin.Context) { return } - b, err := json.Marshal(resp) - if err != nil { - apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1) - return - } - - // Always return "application/jrd+json" regardless of negotiated - // format. See https://www.rfc-editor.org/rfc/rfc7033#section-10.2 - c.Data(http.StatusOK, string(apiutil.AppJRDJSON), b) + // Encode JSON HTTP response. + apiutil.EncodeJSONResponse( + c.Writer, + c.Request, + http.StatusOK, + apiutil.AppJRDJSON, + resp, + ) } |