[bugfix] Serve correct 'application/jrd+json' content type for webfinger requests (#1738)

* [bugfix] Return `application/jrd+json` from webfinger queries

* update finger req content-type
This commit is contained in:
tobi 2023-05-04 12:28:50 +02:00 committed by GitHub
commit 5027d0ced2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 128 additions and 161 deletions

View file

@ -59,8 +59,10 @@ func prepWebfingerReq(ctx context.Context, loc, domain, username string) (*http.
value := url.QueryEscape("acct:" + username + "@" + domain)
req.URL.RawQuery = "resource=" + value
// Prefer application/jrd+json, fall back to application/json.
// See https://www.rfc-editor.org/rfc/rfc7033#section-10.2.
req.Header.Add("Accept", string(apiutil.AppJRDJSON))
req.Header.Add("Accept", string(apiutil.AppJSON))
req.Header.Add("Accept", "application/jrd+json")
req.Header.Set("Host", req.URL.Host)
return req, nil