[chore] Prefer JSON errors in API endpoints (#1766)

* Default to JSON over HTML for error handling

* Change the default error display for web endpoints to html
This commit is contained in:
Natsu Kagami
2023-05-12 08:16:41 +00:00
committed by GitHub
parent 265cc32516
commit ba5a464ca5
11 changed files with 50 additions and 44 deletions

View File

@@ -44,12 +44,12 @@ var WebfingerJSONAcceptHeaders = []MIME{
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
// JSONOrHTMLAcceptHeaders is a slice of offers that prefers AppJSON and will
// fall back to HTML 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.
var HTMLOrJSONAcceptHeaders = []MIME{
TextHTML,
var JSONOrHTMLAcceptHeaders = []MIME{
AppJSON,
TextHTML,
}
// HTMLAcceptHeaders is a slice of offers that just contains text/html types.