diff options
author | 2019-08-26 18:31:24 +0800 | |
---|---|---|
committer | 2019-08-26 10:31:24 +0000 | |
commit | 9fe7fb95c646dfa95b14a5aef44ca4588c9ea8c0 (patch) | |
tree | e9c36abb03d680f0052a7edbdce4a91f687c00d3 | |
parent | dd8238ba9bbdba5accd7237e09b60e5438065f56 (diff) | |
download | coredns-9fe7fb95c646dfa95b14a5aef44ca4588c9ea8c0.tar.gz coredns-9fe7fb95c646dfa95b14a5aef44ca4588c9ea8c0.tar.zst coredns-9fe7fb95c646dfa95b14a5aef44ca4588c9ea8c0.zip |
return standardized text for ready and health endpoint (#3195)
-rw-r--r-- | plugin/health/health.go | 2 | ||||
-rw-r--r-- | plugin/health/health_test.go | 2 | ||||
-rw-r--r-- | plugin/ready/ready.go | 2 | ||||
-rw-r--r-- | test/reload_test.go | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/plugin/health/health.go b/plugin/health/health.go index 55ff68407..2ac75f08d 100644 --- a/plugin/health/health.go +++ b/plugin/health/health.go @@ -42,7 +42,7 @@ func (h *health) OnStartup() error { h.mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) { // We're always healthy. w.WriteHeader(http.StatusOK) - io.WriteString(w, "OK") + io.WriteString(w, http.StatusText(http.StatusOK)) return }) diff --git a/plugin/health/health_test.go b/plugin/health/health_test.go index 7c7ad43a1..35ab285fe 100644 --- a/plugin/health/health_test.go +++ b/plugin/health/health_test.go @@ -31,7 +31,7 @@ func TestHealth(t *testing.T) { } 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)) } } diff --git a/plugin/ready/ready.go b/plugin/ready/ready.go index ff19b59f8..0b08c22f4 100644 --- a/plugin/ready/ready.go +++ b/plugin/ready/ready.go @@ -45,7 +45,7 @@ func (rd *ready) onStartup() error { ok, todo := plugins.Ready() if ok { w.WriteHeader(http.StatusOK) - io.WriteString(w, "OK") + io.WriteString(w, http.StatusText(http.StatusOK)) return } log.Infof("Still waiting on: %q", todo) diff --git a/test/reload_test.go b/test/reload_test.go index e026a97ce..f17a85b05 100644 --- a/test/reload_test.go +++ b/test/reload_test.go @@ -110,7 +110,7 @@ func TestReloadMetricsHealth(t *testing.T) { } ok, _ := ioutil.ReadAll(resp.Body) resp.Body.Close() - if string(ok) != "OK" { + if string(ok) != http.StatusText(http.StatusOK) { t.Errorf("Failed to receive OK, got %s", ok) } |