Home / Function/ Test_Static_Custom_CacheControl() — fiber Function Reference

Test_Static_Custom_CacheControl() — fiber Function Reference

Architecture documentation for the Test_Static_Custom_CacheControl() function in static_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  25574296_15c6_7192_ed02_94cf3cb1121e["Test_Static_Custom_CacheControl()"]
  f26a2d79_1e01_f027_82eb_45c4308747e8["static_test.go"]
  25574296_15c6_7192_ed02_94cf3cb1121e -->|defined in| f26a2d79_1e01_f027_82eb_45c4308747e8
  style 25574296_15c6_7192_ed02_94cf3cb1121e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/static/static_test.go lines 119–139

func Test_Static_Custom_CacheControl(t *testing.T) {
	t.Parallel()
	app := fiber.New()

	app.Get("/*", New("../../.github", Config{
		ModifyResponse: func(c fiber.Ctx) error {
			if strings.Contains(c.GetRespHeader("Content-Type"), "text/html") {
				c.Response().Header.Set("Cache-Control", "no-cache, no-store, must-revalidate")
			}
			return nil
		},
	}))

	resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/index.html", http.NoBody))
	require.NoError(t, err, "app.Test(req)")
	require.Equal(t, "no-cache, no-store, must-revalidate", resp.Header.Get(fiber.HeaderCacheControl), "CacheControl Control")

	normalResp, normalErr := app.Test(httptest.NewRequest(fiber.MethodGet, "/config.yml", http.NoBody))
	require.NoError(t, normalErr, "app.Test(req)")
	require.Empty(t, normalResp.Header.Get(fiber.HeaderCacheControl), "CacheControl Control")
}

Domain

Subdomains

Frequently Asked Questions

What does Test_Static_Custom_CacheControl() do?
Test_Static_Custom_CacheControl() is a function in the fiber codebase, defined in middleware/static/static_test.go.
Where is Test_Static_Custom_CacheControl() defined?
Test_Static_Custom_CacheControl() is defined in middleware/static/static_test.go at line 119.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free