diff options
author | 2023-11-27 14:00:57 +0000 | |
---|---|---|
committer | 2023-11-27 14:00:57 +0000 | |
commit | 74700cc8034980334e7df466f313287a41d2b8a6 (patch) | |
tree | 63ab8912c813eefba8a492e0d0489f4e5fe59446 /internal/api/nodeinfo/nodeinfoget.go | |
parent | [chore]: Bump codeberg.org/gruf/go-mutexes from 1.3.0 to 1.3.1 (#2387) (diff) | |
download | gotosocial-74700cc8034980334e7df466f313287a41d2b8a6.tar.xz |
[performance] http response encoding / writing improvements (#2374)
Diffstat (limited to 'internal/api/nodeinfo/nodeinfoget.go')
-rw-r--r-- | internal/api/nodeinfo/nodeinfoget.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/api/nodeinfo/nodeinfoget.go b/internal/api/nodeinfo/nodeinfoget.go index 3158eeb9a..368a5503d 100644 --- a/internal/api/nodeinfo/nodeinfoget.go +++ b/internal/api/nodeinfo/nodeinfoget.go @@ -18,7 +18,6 @@ package nodeinfo import ( - "encoding/json" "net/http" "github.com/gin-gonic/gin" @@ -55,11 +54,12 @@ func (m *Module) NodeInfo2GETHandler(c *gin.Context) { return } - b, err := json.Marshal(nodeInfo) - if err != nil { - apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1) - return - } - - c.Data(http.StatusOK, NodeInfo2ContentType, b) + // Encode JSON HTTP response. + apiutil.EncodeJSONResponse( + c.Writer, + c.Request, + http.StatusOK, + NodeInfo2ContentType, + nodeInfo, + ) } |