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

Function TestDefaultRouter_NotFoundHandler

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

Source from the content-addressed store, hash-verified

3278}
3279
3280func 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
3297func TestDefaultRouter_MethodNotAllowedHandler(t *testing.T) {
3298 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…