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

Function TestDefaultRouter_MethodNotAllowedHandler

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

Source from the content-addressed store, hash-verified

3295}
3296
3297func 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
3314func TestDefaultRouter_OptionsMethodHandler(t *testing.T) {
3315 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…