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.
This commit is contained in:
argokasper
2023-04-27 07:22:41 +03:00
committed by GitHub
parent 04fb9f4fa1
commit a2d4b95b79

View File

@@ -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