From 113186ce4e5bff2141b826d5da7eb2807eda4b45 Mon Sep 17 00:00:00 2001 From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com> Date: Wed, 21 Jul 2021 17:46:59 +0200 Subject: lil webfingy fix (#106) * lil webfingy fix * return requested content type from fede requests --- internal/api/s2s/user/publickeyget.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'internal/api/s2s/user/publickeyget.go') diff --git a/internal/api/s2s/user/publickeyget.go b/internal/api/s2s/user/publickeyget.go index bb1844e0e..2cbe564df 100644 --- a/internal/api/s2s/user/publickeyget.go +++ b/internal/api/s2s/user/publickeyget.go @@ -2,6 +2,8 @@ package user import ( "context" + "encoding/json" + "fmt" "net/http" "github.com/gin-gonic/gin" @@ -48,5 +50,13 @@ func (m *Module) PublicKeyGETHandler(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) } -- cgit v1.2.3