Merge pull request '[v7.0/forgejo] fix: respond with JSON Resource Descriptor Content-Type per RFC7033' (#2968) from bp-v7.0/forgejo-2c2f146 into v7.0/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2968
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
Gusted 2024-04-02 10:22:01 +00:00
commit 7b97ea7154
2 changed files with 2 additions and 0 deletions

View file

@ -118,4 +118,5 @@ func WebfingerQuery(ctx *context.Context) {
Aliases: aliases, Aliases: aliases,
Links: links, Links: links,
}) })
ctx.Resp.Header().Set("Content-Type", "application/jrd+json")
} }

View file

@ -48,6 +48,7 @@ func TestWebfinger(t *testing.T) {
req := NewRequest(t, "GET", fmt.Sprintf("/.well-known/webfinger?resource=acct:%s@%s", user.LowerName, appURL.Host)) req := NewRequest(t, "GET", fmt.Sprintf("/.well-known/webfinger?resource=acct:%s@%s", user.LowerName, appURL.Host))
resp := MakeRequest(t, req, http.StatusOK) resp := MakeRequest(t, req, http.StatusOK)
assert.Equal(t, resp.Header().Get("Content-Type"), "application/jrd+json")
var jrd webfingerJRD var jrd webfingerJRD
DecodeJSON(t, resp, &jrd) DecodeJSON(t, resp, &jrd)