MCPcopy
hub / github.com/labstack/echo / TestDefaultRouter_OptionsMethodHandler

Function TestDefaultRouter_OptionsMethodHandler

router_test.go:3314–3329  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3312}
3313
3314func 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
3331func TestRouter_RouteWhenNotFoundRouteWithNodeSplitting(t *testing.T) {
3332 e := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
NewRouterFunction · 0.85
requestFunction · 0.85
StringMethod · 0.45
GETMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…