Skip to content

Commit

Permalink
api: WriteHeader on health endpoint
Browse files Browse the repository at this point in the history
Fixes #141.
  • Loading branch information
jzelinskie committed Apr 19, 2016
1 parent af2c688 commit 7aa8869
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 7aa8869

Please sign in to comment.