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.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/cmd/api/healthcheck.go b/cmd/api/healthcheck.go
index c046995..625f4ca 100644
--- a/cmd/api/healthcheck.go
+++ b/cmd/api/healthcheck.go
@@ -1,7 +1,6 @@
package main
import (
- "encoding/json"
"net/http"
)
@@ -11,13 +10,10 @@ func (app *application) healthcheckHandler(w http.ResponseWriter, r *http.Reques
"environment": app.config.env,
"version": version,
}
- js, err := json.Marshal(data)
+ err := app.writeJSON(w, http.StatusOK, data, 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)
return
}
- js = append(js, '\n')
- w.Header().Set("Content-Type", "application/json")
- w.Write([]byte(js))
}