From 2c2f146895b1c8a271546eb5a653b5a99b75418e Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Tue, 2 Apr 2024 14:11:47 +0530 Subject: [PATCH] fix: respond with JSON Resource Descriptor Content-Type per RFC7033 --- routers/web/webfinger.go | 1 + tests/integration/webfinger_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/routers/web/webfinger.go b/routers/web/webfinger.go index a87c426b3b..e4b2aacce8 100644 --- a/routers/web/webfinger.go +++ b/routers/web/webfinger.go @@ -118,4 +118,5 @@ func WebfingerQuery(ctx *context.Context) { Aliases: aliases, Links: links, }) + ctx.Resp.Header().Set("Content-Type", "application/jrd+json") } diff --git a/tests/integration/webfinger_test.go b/tests/integration/webfinger_test.go index a1abc8d32b..55fb211779 100644 --- a/tests/integration/webfinger_test.go +++ b/tests/integration/webfinger_test.go @@ -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)) resp := MakeRequest(t, req, http.StatusOK) + assert.Equal(t, resp.Header().Get("Content-Type"), "application/jrd+json") var jrd webfingerJRD DecodeJSON(t, resp, &jrd)