From 7aa88690af4c85133519747e3633a458e6f44ba0 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Tue, 19 Apr 2016 12:17:13 -0400 Subject: [PATCH] api: WriteHeader on health endpoint Fixes #141. --- api/router.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/router.go b/api/router.go index 96b59d04..808ca5f7 100644 --- a/api/router.go +++ b/api/router.go @@ -63,8 +63,14 @@ func newHealthHandler(ctx *context.RouteContext) http.Handler { } func getHealth(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) (string, int) { + header := w.Header() + header.Set("Server", "clair") + + status := http.StatusInternalServerError if ctx.Store.Ping() { - return "health", http.StatusOK + status = http.StatusOK } - return "health", http.StatusInternalServerError + + w.WriteHeader(status) + return "health", status }