(t *testing.T)
| 491 | } |
| 492 | |
| 493 | func TestRouteNotAllowedEnabled(t *testing.T) { |
| 494 | router := New() |
| 495 | router.HandleMethodNotAllowed = true |
| 496 | router.POST("/path", func(c *Context) {}) |
| 497 | w := PerformRequest(router, http.MethodGet, "/path") |
| 498 | assert.Equal(t, http.StatusMethodNotAllowed, w.Code) |
| 499 | |
| 500 | router.NoMethod(func(c *Context) { |
| 501 | c.String(http.StatusTeapot, "responseText") |
| 502 | }) |
| 503 | w = PerformRequest(router, http.MethodGet, "/path") |
| 504 | assert.Equal(t, "responseText", w.Body.String()) |
| 505 | assert.Equal(t, http.StatusTeapot, w.Code) |
| 506 | } |
| 507 | |
| 508 | func TestRouteNotAllowedEnabled2(t *testing.T) { |
| 509 | router := New() |
nothing calls this directly
no test coverage detected