Procházet zdrojové kódy

allows head requests for /api/health endpoint

closes #9955
bergquist před 8 roky
rodič
revize
3a772c7f7f
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      pkg/api/http_server.go

+ 2 - 1
pkg/api/http_server.go

@@ -194,7 +194,8 @@ func (hs *HttpServer) metricsEndpoint(ctx *macaron.Context) {
 }
 
 func (hs *HttpServer) healthHandler(ctx *macaron.Context) {
-	if ctx.Req.Method != "GET" || ctx.Req.URL.Path != "/api/health" {
+	notHeadOrGet := ctx.Req.Method != http.MethodGet && ctx.Req.Method != http.MethodHead
+	if notHeadOrGet || ctx.Req.URL.Path != "/api/health" {
 		return
 	}