diff options
author | Matthew Lemon <y@yulqen.org> | 2024-03-12 14:51:39 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-03-12 14:51:39 +0000 |
commit | e425d75c00cac5b0b5d4330951af8a15f6f8c6e9 (patch) | |
tree | f03e13ed98a763326732388c8ab3a83e37b105d7 | |
parent | 6cf68f633d43b710ab9aa59948101f54b75593f7 (diff) |
Wraps the JSON response for healthcheck in an envelope
-rw-r--r-- | cmd/api/healthcheck.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cmd/api/healthcheck.go b/cmd/api/healthcheck.go index 625f4ca..4c0a8fa 100644 --- a/cmd/api/healthcheck.go +++ b/cmd/api/healthcheck.go @@ -5,12 +5,14 @@ import ( ) func (app *application) healthcheckHandler(w http.ResponseWriter, r *http.Request) { - data := map[string]string{ - "status": "available", - "environment": app.config.env, - "version": version, + env := envelope{ + "status": "available", + "system_info": map[string]string{ + "environment": app.config.env, + "version": version, + }, } - err := app.writeJSON(w, http.StatusOK, data, nil) + err := app.writeJSON(w, http.StatusOK, env, nil) if err != nil { app.logger.Debug("server error", "err", err) http.Error(w, "The server encountered a problem and could not process your request", http.StatusInternalServerError) |