| 3295 | } |
| 3296 | |
| 3297 | func TestDefaultRouter_MethodNotAllowedHandler(t *testing.T) { |
| 3298 | e := New() |
| 3299 | router := NewRouter(RouterConfig{ |
| 3300 | MethodNotAllowedHandler: func(c *Context) error { |
| 3301 | return c.String(http.StatusTeapot, "405") |
| 3302 | }, |
| 3303 | }) |
| 3304 | e.router = router |
| 3305 | e.GET("/test", func(c *Context) error { |
| 3306 | return c.String(http.StatusOK, "OK") |
| 3307 | }) |
| 3308 | |
| 3309 | status, body := request(http.MethodPost, "/test", e) |
| 3310 | assert.Equal(t, http.StatusTeapot, status) |
| 3311 | assert.Equal(t, "405", body) |
| 3312 | } |
| 3313 | |
| 3314 | func TestDefaultRouter_OptionsMethodHandler(t *testing.T) { |
| 3315 | e := New() |