mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-17 06:53:00 -06:00
[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:
parent
265cc32516
commit
ba5a464ca5
11 changed files with 50 additions and 44 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue