From 5027d0ced25f06c12208cd618cfbb83518610d79 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 4 May 2023 12:28:50 +0200 Subject: [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 --- internal/api/util/negotiate.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'internal/api/util/negotiate.go') diff --git a/internal/api/util/negotiate.go b/internal/api/util/negotiate.go index 0889e0346..1a4df7c40 100644 --- a/internal/api/util/negotiate.go +++ b/internal/api/util/negotiate.go @@ -35,6 +35,15 @@ var JSONAcceptHeaders = []MIME{ AppJSON, } +// WebfingerJSONAcceptHeaders is a slice of offers that prefers the +// jrd+json content type, but will be chill and fall back to app/json. +// This is to be used specifically for webfinger responses. +// See https://www.rfc-editor.org/rfc/rfc7033#section-10.2 +var WebfingerJSONAcceptHeaders = []MIME{ + AppJRDJSON, + AppJSON, +} + // HTMLOrJSONAcceptHeaders is a slice of offers that prefers TextHTML and will // fall back to JSON if necessary. This is useful for error handling, since it can // be used to serve a nice HTML page if the caller accepts that, or just JSON if not. -- cgit v1.2.3