return standardized text for ready and health endpoint (#3195)
This commit is contained in:
parent
dd8238ba9b
commit
9fe7fb95c6
4 changed files with 4 additions and 4 deletions
|
@ -42,7 +42,7 @@ func (h *health) OnStartup() error {
|
||||||
h.mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
h.mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||||
// We're always healthy.
|
// We're always healthy.
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
io.WriteString(w, "OK")
|
io.WriteString(w, http.StatusText(http.StatusOK))
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ func TestHealth(t *testing.T) {
|
||||||
}
|
}
|
||||||
response.Body.Close()
|
response.Body.Close()
|
||||||
|
|
||||||
if string(content) != "OK" {
|
if string(content) != http.StatusText(http.StatusOK) {
|
||||||
t.Errorf("Invalid response body: expecting 'OK', got '%s'", string(content))
|
t.Errorf("Invalid response body: expecting 'OK', got '%s'", string(content))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ func (rd *ready) onStartup() error {
|
||||||
ok, todo := plugins.Ready()
|
ok, todo := plugins.Ready()
|
||||||
if ok {
|
if ok {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
io.WriteString(w, "OK")
|
io.WriteString(w, http.StatusText(http.StatusOK))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Infof("Still waiting on: %q", todo)
|
log.Infof("Still waiting on: %q", todo)
|
||||||
|
|
|
@ -110,7 +110,7 @@ func TestReloadMetricsHealth(t *testing.T) {
|
||||||
}
|
}
|
||||||
ok, _ := ioutil.ReadAll(resp.Body)
|
ok, _ := ioutil.ReadAll(resp.Body)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
if string(ok) != "OK" {
|
if string(ok) != http.StatusText(http.StatusOK) {
|
||||||
t.Errorf("Failed to receive OK, got %s", ok)
|
t.Errorf("Failed to receive OK, got %s", ok)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue