From 53520d89f6117d708c966f4c95ae01febc66c1d9 Mon Sep 17 00:00:00 2001 From: glefloch Date: Mon, 27 Aug 2018 17:09:47 +0200 Subject: [PATCH] Sanitize http method to uppercase Signed-off-by: glefloch --- prometheus/promhttp/instrument_server.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/prometheus/promhttp/instrument_server.go b/prometheus/promhttp/instrument_server.go index 9db2438..e7c737e 100644 --- a/prometheus/promhttp/instrument_server.go +++ b/prometheus/promhttp/instrument_server.go @@ -322,23 +322,23 @@ func computeApproximateRequestSize(r *http.Request) int { func sanitizeMethod(m string) string { switch m { case "GET", "get": - return "get" + return "GET" case "PUT", "put": - return "put" + return "PUT" case "HEAD", "head": - return "head" + return "HEAD" case "POST", "post": - return "post" + return "POST" case "DELETE", "delete": - return "delete" + return "DELETE" case "CONNECT", "connect": - return "connect" + return "CONNECT" case "OPTIONS", "options": - return "options" + return "OPTIONS" case "NOTIFY", "notify": - return "notify" + return "NOTIFY" default: - return strings.ToLower(m) + return strings.ToUpper(m) } }