We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d51f9de commit 2ee48a5Copy full SHA for 2ee48a5
1 file changed
handler.go
@@ -29,15 +29,16 @@ func HTTPHandler(hc HealthChecker) http.Handler {
29
if hc == nil {
30
panic(panicNilHealthChecker)
31
}
32
+
33
if checker, ok := hc.(*Checker); ok {
34
return http.HandlerFunc(func(wri http.ResponseWriter, req *http.Request) {
35
stat := checker.CheckHealth(req.Context())
- wri.WriteHeader(stat.StatusCode())
36
-
37
if stat == StatusHealthy {
+ wri.WriteHeader(stat.StatusCode())
38
_, _ = wri.Write(okBytes)
39
} else {
40
wri.Header().Set("Content-Type", "application/json")
41
42
_ = json.NewEncoder(wri).Encode(checker.Details())
43
44
})
0 commit comments