(t *testing.T)
| 934 | } |
| 935 | |
| 936 | func TestServeMux_InjectPattern(t *testing.T) { |
| 937 | mux := runtime.NewServeMux() |
| 938 | err := mux.HandlePath("GET", "/test", func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) { |
| 939 | p, ok := runtime.HTTPPattern(r.Context()) |
| 940 | if !ok { |
| 941 | t.Errorf("pattern is not injected") |
| 942 | } |
| 943 | if p.String() != "/test" { |
| 944 | t.Errorf("pattern not /test") |
| 945 | } |
| 946 | }) |
| 947 | if err != nil { |
| 948 | t.Errorf("The route test with method GET and path /test invalid, got %v", err) |
| 949 | } |
| 950 | |
| 951 | r := httptest.NewRequest("GET", "/test", nil) |
| 952 | w := httptest.NewRecorder() |
| 953 | mux.ServeHTTP(w, r) |
| 954 | if w.Code != 200 { |
| 955 | t.Errorf("request not processed") |
| 956 | } |
| 957 | } |
| 958 | |
| 959 | func TestServeHTTP_WithDisableHTTPMethodOverride(t *testing.T) { |
| 960 | // When WithDisableHTTPMethodOverride is set, X-HTTP-Method-Override |
nothing calls this directly
no test coverage detected