summaryrefslogtreecommitdiff
path: root/internal/api/util/negotiate.go
diff options
context:
space:
mode:
authorLibravatar Natsu Kagami <natsukagami@gmail.com>2023-05-12 08:16:41 +0000
committerLibravatar GitHub <noreply@github.com>2023-05-12 10:16:41 +0200
commitba5a464ca5d3fcbd171c174a4f07c3326ecb01df (patch)
tree4289873a2fef9a9b102fb692b0cf6d3409a41747 /internal/api/util/negotiate.go
parentuse more semantic headers for profile page (#1765) (diff)
downloadgotosocial-ba5a464ca5d3fcbd171c174a4f07c3326ecb01df.tar.xz
[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
Diffstat (limited to 'internal/api/util/negotiate.go')
-rw-r--r--internal/api/util/negotiate.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/api/util/negotiate.go b/internal/api/util/negotiate.go
index 1a4df7c40..8e7f41134 100644
--- a/internal/api/util/negotiate.go
+++ b/internal/api/util/negotiate.go
@@ -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.