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

Function TestRouteStaticListingDir

routes_test.go:450–459  ·  view source on GitHub ↗

TestHandleStaticDir - ensure the root/sub dir handles properly

(t *testing.T)

Source from the content-addressed store, hash-verified

448
449// TestHandleStaticDir - ensure the root/sub dir handles properly
450func TestRouteStaticListingDir(t *testing.T) {
451 router := New()
452 router.StaticFS("/", Dir("./", true))
453
454 w := PerformRequest(router, http.MethodGet, "/")
455
456 assert.Equal(t, http.StatusOK, w.Code)
457 assert.Contains(t, w.Body.String(), "gin.go")
458 assert.Equal(t, "text/html; charset=utf-8", w.Header().Get("Content-Type"))
459}
460
461// TestHandleHeadToDir - ensure the root/sub dir handles properly
462func TestRouteStaticNoListing(t *testing.T) {

Callers

nothing calls this directly

Calls 7

NewFunction · 0.85
DirFunction · 0.85
PerformRequestFunction · 0.85
StaticFSMethod · 0.65
StringMethod · 0.65
GetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected