aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/api/healthcheck.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/api/healthcheck.go')
-rw-r--r--cmd/api/healthcheck.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/api/healthcheck.go b/cmd/api/healthcheck.go
index 68bed0d..c4f52f2 100644
--- a/cmd/api/healthcheck.go
+++ b/cmd/api/healthcheck.go
@@ -6,7 +6,8 @@ import (
)
func (app *application) healthcheckHandler(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintln(w, "status: available")
- fmt.Fprintf(w, "environment: %s\n", app.config.env)
- fmt.Fprintf(w, "version: %s\n", version)
+ js := `{"status": "available", "environment": %q, "version": %q}`
+ js = fmt.Sprintf(js, app.config.env, version)
+ w.Header().Set("Content-Type", "application/json")
+ w.Write([]byte(js))
}