From a2d4b95b79ccb8dc1f50105bc2e899457a2edc65 Mon Sep 17 00:00:00 2001 From: argokasper Date: Thu, 27 Apr 2023 07:22:41 +0300 Subject: [PATCH] Fix GET validation for lowercase http methods (#2497) Some requests send method in lowercase (verified with curl and as a default for AWS ALB health check requests), but Go HTTP library constant MethodGet is in upper. --- .../horizontal_runner_autoscaler_webhook.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/actions.summerwind.net/horizontal_runner_autoscaler_webhook.go b/controllers/actions.summerwind.net/horizontal_runner_autoscaler_webhook.go index a377fb9f..09013c7f 100644 --- a/controllers/actions.summerwind.net/horizontal_runner_autoscaler_webhook.go +++ b/controllers/actions.summerwind.net/horizontal_runner_autoscaler_webhook.go @@ -115,7 +115,7 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Handle(w http.Respons }() // respond ok to GET / e.g. for health check - if r.Method == http.MethodGet { + if strings.ToUpper(r.Method) == http.MethodGet { ok = true fmt.Fprintln(w, "webhook server is running") return