Skip to content

Commit

Permalink
Merge pull request #142 from jzelinskie/healthfix
Browse files Browse the repository at this point in the history
api: WriteHeader on health endpoint
  • Loading branch information
Quentin-M committed Apr 19, 2016
2 parents af2c688 + 7aa8869 commit 58fd619
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 58fd619

Please sign in to comment.