(t *testing.T)
| 1735 | } |
| 1736 | |
| 1737 | func TestSubrouterErrorHandling(t *testing.T) { |
| 1738 | superRouterCalled := false |
| 1739 | subRouterCalled := false |
| 1740 | |
| 1741 | router := NewRouter() |
| 1742 | router.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 1743 | superRouterCalled = true |
| 1744 | }) |
| 1745 | subRouter := router.PathPrefix("/bign8").Subrouter() |
| 1746 | subRouter.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 1747 | subRouterCalled = true |
| 1748 | }) |
| 1749 | |
| 1750 | req, _ := http.NewRequest("GET", "http://localhost/bign8/was/here", nil) |
| 1751 | router.ServeHTTP(NewRecorder(), req) |
| 1752 | |
| 1753 | if superRouterCalled { |
| 1754 | t.Error("Super router 404 handler called when sub-router 404 handler is available.") |
| 1755 | } |
| 1756 | if !subRouterCalled { |
| 1757 | t.Error("Sub-router 404 handler was not called.") |
| 1758 | } |
| 1759 | } |
| 1760 | |
| 1761 | // See: https://github.com/gorilla/mux/issues/200 |
| 1762 | func TestPanicOnCapturingGroups(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…