Home / Function/ Test_Cache_Invalid_Expiration() — fiber Function Reference

Test_Cache_Invalid_Expiration() — fiber Function Reference

Architecture documentation for the Test_Cache_Invalid_Expiration() function in cache_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  82c8d773_8bd8_dfb9_c0a3_acb49ac44fb0["Test_Cache_Invalid_Expiration()"]
  8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"]
  82c8d773_8bd8_dfb9_c0a3_acb49ac44fb0 -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656
  style 82c8d773_8bd8_dfb9_c0a3_acb49ac44fb0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/cache/cache_test.go lines 855–882

func Test_Cache_Invalid_Expiration(t *testing.T) {
	t.Parallel()

	app := fiber.New()
	cache := New(Config{Expiration: 0 * time.Second})
	app.Use(cache)

	count := 0
	app.Get("/", func(c fiber.Ctx) error {
		count++
		return c.SendString(strconv.Itoa(count))
	})

	req := httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
	resp, err := app.Test(req)
	require.NoError(t, err)

	cachedReq := httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
	cachedResp, err := app.Test(cachedReq)
	require.NoError(t, err)

	body, err := io.ReadAll(resp.Body)
	require.NoError(t, err)
	cachedBody, err := io.ReadAll(cachedResp.Body)
	require.NoError(t, err)

	require.Equal(t, cachedBody, body)
}

Subdomains

Frequently Asked Questions

What does Test_Cache_Invalid_Expiration() do?
Test_Cache_Invalid_Expiration() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is Test_Cache_Invalid_Expiration() defined?
Test_Cache_Invalid_Expiration() is defined in middleware/cache/cache_test.go at line 855.

Analyze Your Own Codebase

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

Try Supermodel Free