Skip to content

Commit

Permalink
Changes /ping route to return status code 200 instead of 204 when ver…
Browse files Browse the repository at this point in the history
…bose is set

Closes #9772.
  • Loading branch information
ryuhhnn authored and jsternberg committed Oct 2, 2018
1 parent 677552f commit 76fe3f0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion services/httpd/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,16 @@ func (h *Handler) serveOptions(w http.ResponseWriter, r *http.Request) {

// servePing returns a simple response to let the client know the server is running.
func (h *Handler) servePing(w http.ResponseWriter, r *http.Request) {
verbose := r.URL.Query().Get("verbose")
atomic.AddInt64(&h.stats.PingRequests, 1)
h.writeHeader(w, http.StatusNoContent)

if verbose != "" && verbose != "0" && verbose != "false" {
h.writeHeader(w, http.StatusOK)
b, _ := json.Marshal(map[string]string{"version": h.Version})
w.Write(b)
} else {
h.writeHeader(w, http.StatusNoContent)
}
}

// serveStatus has been deprecated.
Expand Down

0 comments on commit 76fe3f0

Please sign in to comment.