1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-08 10:45:04 +02:00

Allow query params for health endpoint; Log health response

This commit is contained in:
DarthSim 2019-06-03 17:06:13 +06:00
parent f515623f3a
commit 2a7715540b

View File

@ -188,6 +188,12 @@ func respondWithOptions(reqID string, rw http.ResponseWriter) {
rw.WriteHeader(200)
}
func respondWithHealth(reqID string, rw http.ResponseWriter) {
logResponse(reqID, 200, string(imgproxyIsRunningMsg))
rw.WriteHeader(200)
rw.Write(imgproxyIsRunningMsg)
}
func respondWithNotModified(reqID string, rw http.ResponseWriter) {
logResponse(reqID, 200, "Not modified")
rw.WriteHeader(304)
@ -266,9 +272,8 @@ func (h *httpHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
panic(errInvalidMethod)
}
if r.URL.RequestURI() == healthPath {
rw.WriteHeader(200)
rw.Write(imgproxyIsRunningMsg)
if r.URL.Path == healthPath {
respondWithHealth(reqID, rw)
return
}