From 26647571af22baf2450749680c18e2e687a95ca1 Mon Sep 17 00:00:00 2001 From: Umputun Date: Tue, 13 Apr 2021 01:28:22 -0500 Subject: [PATCH] lint: simplify health and ping path check --- app/proxy/health.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/proxy/health.go b/app/proxy/health.go index ec7c2be..65dd235 100644 --- a/app/proxy/health.go +++ b/app/proxy/health.go @@ -16,7 +16,7 @@ import ( func (h *Http) healthMiddleware(next http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { - if r.Method == "GET" && strings.ToLower(r.URL.Path) == "/health" { + if r.Method == "GET" && strings.EqualFold(r.URL.Path, "/health") { h.healthHandler(w, r) return } @@ -94,7 +94,7 @@ func (h *Http) healthHandler(w http.ResponseWriter, _ *http.Request) { func (h *Http) pingHandler(next http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { - if r.Method == "GET" && strings.ToLower(r.URL.Path) == "/ping" { + if r.Method == "GET" && strings.EqualFold(r.URL.Path, "/ping") { w.Header().Set("Content-Type", "text/plain") w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte("pong"))