diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-14 12:47:25 -0400 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-14 12:47:25 -0400 |
commit | 04096e175a60ffaf247a03f5cb9d94909e7409c2 (patch) | |
tree | 9e8fdef509e62776133639f57c37e659c7d2a74c | |
parent | d6247edb2ab541540b4f0420fff5b8ae43a5f8c1 (diff) | |
download | Atlas-04096e175a60ffaf247a03f5cb9d94909e7409c2.tar.gz Atlas-04096e175a60ffaf247a03f5cb9d94909e7409c2.zip |
pkg/api/api0: Append newline to JSON responses
Makes it nicer to use with tools like curl.
-rw-r--r-- | pkg/api/api0/api.go | 1 |
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) |