TestHandleStaticDir - ensure the root/sub dir handles properly
(t *testing.T)
| 448 | |
| 449 | // TestHandleStaticDir - ensure the root/sub dir handles properly |
| 450 | func 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 |
| 462 | func TestRouteStaticNoListing(t *testing.T) { |