Test_CacheExpiresFutureAllowsCaching() — fiber Function Reference
Architecture documentation for the Test_CacheExpiresFutureAllowsCaching() function in cache_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 6499c387_9fac_42af_1e74_6df66f628f43["Test_CacheExpiresFutureAllowsCaching()"] 8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"] 6499c387_9fac_42af_1e74_6df66f628f43 -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656 style 6499c387_9fac_42af_1e74_6df66f628f43 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/cache/cache_test.go lines 1639–1667
func Test_CacheExpiresFutureAllowsCaching(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Use(New(Config{
StoreResponseHeaders: true,
}))
var count int
app.Get("/", func(c fiber.Ctx) error {
count++
c.Set(fiber.HeaderExpires, time.Now().Add(30*time.Second).UTC().Format(time.RFC1123))
return c.SendString("expires" + strconv.Itoa(count))
})
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
require.NoError(t, err)
require.Equal(t, cacheMiss, resp.Header.Get("X-Cache"))
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "expires1", string(body))
resp, err = app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
require.NoError(t, err)
require.Equal(t, cacheHit, resp.Header.Get("X-Cache"))
body, err = io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "expires1", string(body))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_CacheExpiresFutureAllowsCaching() do?
Test_CacheExpiresFutureAllowsCaching() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is Test_CacheExpiresFutureAllowsCaching() defined?
Test_CacheExpiresFutureAllowsCaching() is defined in middleware/cache/cache_test.go at line 1639.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free