diff options
author | 2021-07-21 17:46:59 +0200 | |
---|---|---|
committer | 2021-07-21 17:46:59 +0200 | |
commit | 113186ce4e5bff2141b826d5da7eb2807eda4b45 (patch) | |
tree | f31e7300e5c5870d3407056c98b818905f92d8c5 /internal/api/s2s/user/userget.go | |
parent | Config bugfix (#104) (diff) | |
download | gotosocial-113186ce4e5bff2141b826d5da7eb2807eda4b45.tar.xz |
lil webfingy fix (#106)
* lil webfingy fix
* return requested content type from fede requests
Diffstat (limited to 'internal/api/s2s/user/userget.go')
-rw-r--r-- | internal/api/s2s/user/userget.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/api/s2s/user/userget.go b/internal/api/s2s/user/userget.go index ac49b1529..f2f846f97 100644 --- a/internal/api/s2s/user/userget.go +++ b/internal/api/s2s/user/userget.go @@ -20,6 +20,8 @@ package user import ( "context" + "encoding/json" + "fmt" "net/http" "github.com/gin-gonic/gin" @@ -70,5 +72,13 @@ func (m *Module) UsersGETHandler(c *gin.Context) { return } - c.JSON(http.StatusOK, user) + b, mErr := json.Marshal(user) + if mErr != nil { + err := fmt.Errorf("could not marshal json: %s", mErr) + l.Error(err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.Data(http.StatusOK, format, b) } |