MCPcopy
hub / github.com/gin-gonic/gin / TestRouterStaticFSNotFound

Function TestRouterStaticFSNotFound

routes_test.go:635–647  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

633}
634
635func TestRouterStaticFSNotFound(t *testing.T) {
636 router := New()
637 router.StaticFS("/", http.FileSystem(http.Dir("/thisreallydoesntexist/")))
638 router.NoRoute(func(c *Context) {
639 c.String(http.StatusNotFound, "non existent")
640 })
641
642 w := PerformRequest(router, http.MethodGet, "/nonexistent")
643 assert.Equal(t, "non existent", w.Body.String())
644
645 w = PerformRequest(router, http.MethodHead, "/nonexistent")
646 assert.Equal(t, "non existent", w.Body.String())
647}
648
649func TestRouterStaticFSFileNotFound(t *testing.T) {
650 router := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
PerformRequestFunction · 0.85
NoRouteMethod · 0.80
StaticFSMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected