Skip to content

Commit

Permalink
make health check reponse idiomatic
Browse files Browse the repository at this point in the history
  • Loading branch information
yunheL committed Aug 9, 2023
1 parent 45eed91 commit ed01699
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,14 @@ func (a *App) handleClusteringGet(w http.ResponseWriter, r *http.Request) {
}

func (a *App) handleHealthzGet(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("I'm healthy!\n"))
s := map[string]string{"status": "healthy",}
b, err := json.Marshal(s)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
json.NewEncoder(w).Encode(APIErrors{Errors: []string{err.Error()}})
return
}
w.Write(b)
}

func (a *App) handleClusteringMembersGet(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit ed01699

Please sign in to comment.