| 3278 | } |
| 3279 | |
| 3280 | func TestDefaultRouter_NotFoundHandler(t *testing.T) { |
| 3281 | e := New() |
| 3282 | router := NewRouter(RouterConfig{ |
| 3283 | NotFoundHandler: func(c *Context) error { |
| 3284 | return c.String(http.StatusTeapot, "404") |
| 3285 | }, |
| 3286 | }) |
| 3287 | e.router = router |
| 3288 | e.GET("/test", func(c *Context) error { |
| 3289 | return c.String(http.StatusOK, "OK") |
| 3290 | }) |
| 3291 | |
| 3292 | status, body := request(http.MethodGet, "/noFound", e) |
| 3293 | assert.Equal(t, http.StatusTeapot, status) |
| 3294 | assert.Equal(t, "404", body) |
| 3295 | } |
| 3296 | |
| 3297 | func TestDefaultRouter_MethodNotAllowedHandler(t *testing.T) { |
| 3298 | e := New() |