| 1 | package metricsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/internal/metrics`/ |
| 2 | |
| 3 | import ( |
| 4 | "stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.25.1 testing/" |
| 6 | ) |
| 7 | |
| 8 | func TestSanitizeMethodscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/internal/metrics`/TestSanitizeMethod().(t *testingscip-go gomod github.com/golang/go/src go1.25.1 testing/.Tscip-go gomod github.com/golang/go/src go1.25.1 testing/T#) { |
| 9 | tests := []struct { |
| 10 | method string |
| 11 | expected string |
| 12 | }{ |
| 13 | {method: "get", expected: "GET"}, |
| 14 | {method: "POST", expected: "POST"}, |
| 15 | {method: "OPTIONS", expected: "OPTIONS"}, |
| 16 | {method: "connect", expected: "CONNECT"}, |
| 17 | {method: "trace", expected: "TRACE"}, |
| 18 | {method: "UNKNOWN", expected: "OTHER"}, |
| 19 | {method: stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25.1 strings/Repeat().("ohno", 9999), expected: "OTHER"}, |
| 20 | } |
| 21 | |
| 22 | for _, d := range tests { |
| 23 | actual := SanitizeMethodscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/internal/metrics`/SanitizeMethod().(d.method) |
| 24 | if actual != d.expected { |
| 25 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.1 testing/common#Errorf().("Not same: expected %#v, but got %#v", d.expected, actual) |
| 26 | } |
| 27 | } |
| 28 | } |