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

Function TestRouteStaticNoListing

routes_test.go:462–470  ·  view source on GitHub ↗

TestHandleHeadToDir - ensure the root/sub dir handles properly

(t *testing.T)

Source from the content-addressed store, hash-verified

460
461// TestHandleHeadToDir - ensure the root/sub dir handles properly
462func TestRouteStaticNoListing(t *testing.T) {
463 router := New()
464 router.Static("/", "./")
465
466 w := PerformRequest(router, http.MethodGet, "/")
467
468 assert.Equal(t, http.StatusNotFound, w.Code)
469 assert.NotContains(t, w.Body.String(), "gin.go")
470}
471
472func TestRouterMiddlewareAndStatic(t *testing.T) {
473 router := New()

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
PerformRequestFunction · 0.85
StaticMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected