| 3312 | } |
| 3313 | |
| 3314 | func TestDefaultRouter_OptionsMethodHandler(t *testing.T) { |
| 3315 | e := New() |
| 3316 | router := NewRouter(RouterConfig{ |
| 3317 | OptionsMethodHandler: func(c *Context) error { |
| 3318 | return c.String(http.StatusBadRequest, "not empty") |
| 3319 | }, |
| 3320 | }) |
| 3321 | e.router = router |
| 3322 | e.GET("/test", func(c *Context) error { |
| 3323 | return c.String(http.StatusOK, "OK") |
| 3324 | }) |
| 3325 | |
| 3326 | status, body := request(http.MethodOptions, "/test", e) |
| 3327 | assert.Equal(t, http.StatusBadRequest, status) |
| 3328 | assert.Equal(t, "not empty", body) |
| 3329 | } |
| 3330 | |
| 3331 | func TestRouter_RouteWhenNotFoundRouteWithNodeSplitting(t *testing.T) { |
| 3332 | e := New() |