aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/api0/api.go
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-14 12:47:25 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-14 12:47:25 -0400
commit04096e175a60ffaf247a03f5cb9d94909e7409c2 (patch)
tree9e8fdef509e62776133639f57c37e659c7d2a74c /pkg/api/api0/api.go
parentd6247edb2ab541540b4f0420fff5b8ae43a5f8c1 (diff)
downloadAtlas-04096e175a60ffaf247a03f5cb9d94909e7409c2.tar.gz
Atlas-04096e175a60ffaf247a03f5cb9d94909e7409c2.zip
pkg/api/api0: Append newline to JSON responses
Makes it nicer to use with tools like curl.
Diffstat (limited to 'pkg/api/api0/api.go')
-rw-r--r--pkg/api/api0/api.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkg/api/api0/api.go b/pkg/api/api0/api.go
index f7b787c..2c154cb 100644
--- a/pkg/api/api0/api.go
+++ b/pkg/api/api0/api.go
@@ -122,6 +122,7 @@ func respJSON(w http.ResponseWriter, r *http.Request, status int, obj any) {
if err != nil {
panic(err)
}
+ buf = append(buf, '\n')
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Header().Set("Content-Length", strconv.Itoa(len(buf)))
w.WriteHeader(status)