diff options
author | Dave Henderson <[email protected]> | 2022-01-24 08:35:51 -0500 |
---|---|---|
committer | Dave Henderson <[email protected]> | 2022-01-25 15:07:17 -0500 |
commit | 7ca5921a87c819f9848ccd7ec786aab0f896be72 (patch) | |
tree | a8dbe6a5bbb0aa10dc9ab9c2f5111e017e559358 /modules/caddyhttp/metrics_test.go | |
parent | da4a759bad70cae9f4f1f38a03c26f75aa04352f (diff) | |
download | caddy-7ca5921a87c819f9848ccd7ec786aab0f896be72.tar.gz caddy-7ca5921a87c819f9848ccd7ec786aab0f896be72.zip |
move common metrics-related funcs to internal package
Signed-off-by: Dave Henderson <[email protected]>
Diffstat (limited to 'modules/caddyhttp/metrics_test.go')
-rw-r--r-- | modules/caddyhttp/metrics_test.go | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/modules/caddyhttp/metrics_test.go b/modules/caddyhttp/metrics_test.go index 95f6d9b69..6311935ae 100644 --- a/modules/caddyhttp/metrics_test.go +++ b/modules/caddyhttp/metrics_test.go @@ -5,7 +5,6 @@ import ( "errors" "net/http" "net/http/httptest" - "strings" "testing" "github.com/prometheus/client_golang/prometheus/testutil" @@ -83,25 +82,3 @@ type middlewareHandlerFunc func(http.ResponseWriter, *http.Request, Handler) err func (f middlewareHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request, h Handler) error { return f(w, r, h) } - -func TestSanitizeMethod(t *testing.T) { - tests := []struct { - method string - expected string - }{ - {method: "get", expected: "GET"}, - {method: "POST", expected: "POST"}, - {method: "OPTIONS", expected: "OPTIONS"}, - {method: "connect", expected: "CONNECT"}, - {method: "trace", expected: "TRACE"}, - {method: "UNKNOWN", expected: "OTHER"}, - {method: strings.Repeat("ohno", 9999), expected: "OTHER"}, - } - - for _, d := range tests { - actual := sanitizeMethod(d.method) - if actual != d.expected { - t.Errorf("Not same: expected %#v, but got %#v", d.expected, actual) - } - } -} |