(t *testing.T)
| 2842 | } |
| 2843 | |
| 2844 | func TestSubrouterNotFound(t *testing.T) { |
| 2845 | handler := func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) } |
| 2846 | router := NewRouter() |
| 2847 | router.Path("/a").Subrouter().HandleFunc("/thing", handler).Methods(http.MethodGet) |
| 2848 | router.Path("/b").Subrouter().HandleFunc("/something", handler).Methods(http.MethodGet) |
| 2849 | |
| 2850 | w := NewRecorder() |
| 2851 | req := newRequest(http.MethodPut, "/not-present") |
| 2852 | |
| 2853 | router.ServeHTTP(w, req) |
| 2854 | |
| 2855 | if w.Code != http.StatusNotFound { |
| 2856 | t.Fatalf("Expected status code 404 (got %d)", w.Code) |
| 2857 | } |
| 2858 | } |
| 2859 | |
| 2860 | func TestContextMiddleware(t *testing.T) { |
| 2861 | withTimeout := func(h http.Handler) http.Handler { |
nothing calls this directly
no test coverage detected