mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-15 08:43:01 -06:00
[performance] http response encoding / writing improvements (#2374)
This commit is contained in:
parent
d7e35f6bc9
commit
74700cc803
104 changed files with 526 additions and 267 deletions
|
|
@ -107,7 +107,7 @@ func (m *Module) AccountCreatePOSTHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, ti)
|
||||
apiutil.JSON(c, http.StatusOK, ti)
|
||||
}
|
||||
|
||||
// validateNormalizeCreateAccount checks through all the necessary prerequisites for creating a new account,
|
||||
|
|
|
|||
|
|
@ -96,5 +96,7 @@ func (m *Module) AccountDeletePOSTHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusAccepted, gin.H{"message": "accepted"})
|
||||
apiutil.JSON(c, http.StatusAccepted, map[string]string{
|
||||
"message": "accepted",
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,5 +90,5 @@ func (m *Module) AccountGETHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, acctInfo)
|
||||
apiutil.JSON(c, http.StatusOK, acctInfo)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ func (m *Module) AccountUpdateCredentialsPATCHHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, acctSensitive)
|
||||
apiutil.JSON(c, http.StatusOK, acctSensitive)
|
||||
}
|
||||
|
||||
// fieldsAttributesFormBinding satisfies gin's binding.Binding interface.
|
||||
|
|
|
|||
|
|
@ -73,5 +73,5 @@ func (m *Module) AccountVerifyGETHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, acctSensitive)
|
||||
apiutil.JSON(c, http.StatusOK, acctSensitive)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,5 +90,5 @@ func (m *Module) AccountBlockPOSTHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, relationship)
|
||||
apiutil.JSON(c, http.StatusOK, relationship)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,5 +122,5 @@ func (m *Module) AccountFollowPOSTHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, relationship)
|
||||
apiutil.JSON(c, http.StatusOK, relationship)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,5 +151,5 @@ func (m *Module) AccountFollowersGETHandler(c *gin.Context) {
|
|||
c.Header("Link", resp.LinkHeader)
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, resp.Items)
|
||||
apiutil.JSON(c, http.StatusOK, resp.Items)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,5 +151,5 @@ func (m *Module) AccountFollowingGETHandler(c *gin.Context) {
|
|||
c.Header("Link", resp.LinkHeader)
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, resp.Items)
|
||||
apiutil.JSON(c, http.StatusOK, resp.Items)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,5 +93,5 @@ func (m *Module) AccountListsGETHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, lists)
|
||||
apiutil.JSON(c, http.StatusOK, lists)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,5 +89,5 @@ func (m *Module) AccountLookupGETHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, account)
|
||||
apiutil.JSON(c, http.StatusOK, account)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,5 +104,5 @@ func (m *Module) AccountNotePOSTHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, relationship)
|
||||
apiutil.JSON(c, http.StatusOK, relationship)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,5 +106,5 @@ func (m *Module) AccountRelationshipsGETHandler(c *gin.Context) {
|
|||
relationships = append(relationships, *r)
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, relationships)
|
||||
apiutil.JSON(c, http.StatusOK, relationships)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,5 +162,5 @@ func (m *Module) AccountSearchGETHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, results)
|
||||
apiutil.JSON(c, http.StatusOK, results)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,5 +241,6 @@ func (m *Module) AccountStatusesGETHandler(c *gin.Context) {
|
|||
if resp.LinkHeader != "" {
|
||||
c.Header("Link", resp.LinkHeader)
|
||||
}
|
||||
c.JSON(http.StatusOK, resp.Items)
|
||||
|
||||
apiutil.JSON(c, http.StatusOK, resp.Items)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,5 +91,6 @@ func (m *Module) AccountUnblockPOSTHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, relationship)
|
||||
apiutil.JSON(c, http.StatusOK, relationship)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,5 +91,5 @@ func (m *Module) AccountUnfollowPOSTHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, relationship)
|
||||
apiutil.JSON(c, http.StatusOK, relationship)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue