Skip to content

Commit

Permalink
changing ok response to json to match error
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Turcan committed Oct 10, 2022
1 parent 6fe5d5d commit 0dd29f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/rpc/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ func NodeSyncingRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
}
}

type HealthcheckResponse struct {
Health string `json:"health"`
}

// REST handler for node health check - aws recognizes only http status codes
func NodeHealthRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
Expand All @@ -141,7 +145,7 @@ func NodeHealthRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
if status.SyncInfo.CatchingUp {
rest.WriteErrorResponse(w, http.StatusServiceUnavailable, "NOK")
} else {
rest.PostProcessResponseBare(w, clientCtx, []byte("OK"))
rest.PostProcessResponseBare(w, clientCtx, HealthcheckResponse{Health: "OK"})
}
}
}

0 comments on commit 0dd29f4

Please sign in to comment.