TestCacheAllowsSharedCacheWithAuthorization() — fiber Function Reference
Architecture documentation for the TestCacheAllowsSharedCacheWithAuthorization() function in cache_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD fc58f82a_c6d1_62f4_e8b3_3c5bbe3dc557["TestCacheAllowsSharedCacheWithAuthorization()"] 8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"] fc58f82a_c6d1_62f4_e8b3_3c5bbe3dc557 -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656 style fc58f82a_c6d1_62f4_e8b3_3c5bbe3dc557 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/cache/cache_test.go lines 3121–3151
func TestCacheAllowsSharedCacheWithAuthorization(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Use(New(Config{Expiration: 10 * time.Second}))
var count int
app.Get("/", func(c fiber.Ctx) error {
count++
c.Set(fiber.HeaderCacheControl, "public, max-age=60")
return c.SendString("ok")
})
req := httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
req.Header.Set(fiber.HeaderAuthorization, "Bearer token")
resp, err := app.Test(req)
require.NoError(t, err)
require.Equal(t, cacheMiss, resp.Header.Get("X-Cache"))
req = httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
req.Header.Set(fiber.HeaderAuthorization, "Bearer token")
resp, err = app.Test(req)
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, "ok", string(body))
require.Equal(t, 1, count)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestCacheAllowsSharedCacheWithAuthorization() do?
TestCacheAllowsSharedCacheWithAuthorization() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is TestCacheAllowsSharedCacheWithAuthorization() defined?
TestCacheAllowsSharedCacheWithAuthorization() is defined in middleware/cache/cache_test.go at line 3121.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free