diff options
author | 2024-01-28 02:49:04 -0800 | |
---|---|---|
committer | 2024-01-28 11:49:04 +0100 | |
commit | 7e0a20317316cafb87dc06b60d0c83b3cac80896 (patch) | |
tree | fd5422a408ac168ebe236e97e27a6effa140f598 /internal/api/util/response.go | |
parent | [docs] Rework storage (#2571) (diff) | |
download | gotosocial-7e0a20317316cafb87dc06b60d0c83b3cac80896.tar.xz |
[bugfix] Fix EmptyJSONObject/EmptyJSONArray (#2576)
* Fix EmptyJSONObject/EmptyJSONArray
These are meant to be the bytes representing an empty object and array in JSON: `{}` and `[]`. They are actually the strings `"{}"` and `"[]"`. This causes clients expecting an object or array to not be able to parse the response.
* Use json.RawMessage instead of []byte
Diffstat (limited to 'internal/api/util/response.go')
-rw-r--r-- | internal/api/util/response.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/api/util/response.go b/internal/api/util/response.go index 753eaefb8..afdc578aa 100644 --- a/internal/api/util/response.go +++ b/internal/api/util/response.go @@ -51,8 +51,8 @@ var ( ErrorRateLimited = mustJSON(map[string]string{ "error": "rate limit reached", }) - EmptyJSONObject = mustJSON("{}") - EmptyJSONArray = mustJSON("[]") + EmptyJSONObject = json.RawMessage(`{}`) + EmptyJSONArray = json.RawMessage(`[]`) // write buffer pool. bufPool sync.Pool |