Test_CacheAllowsSharedCacheProxyRevalidateWithAuthorization() — fiber Function Reference
Architecture documentation for the Test_CacheAllowsSharedCacheProxyRevalidateWithAuthorization() function in cache_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 4d32f1b5_0b2a_25b4_46b6_be9793f89700["Test_CacheAllowsSharedCacheProxyRevalidateWithAuthorization()"] 8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"] 4d32f1b5_0b2a_25b4_46b6_be9793f89700 -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656 style 4d32f1b5_0b2a_25b4_46b6_be9793f89700 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/cache/cache_test.go lines 1734–1769
func Test_CacheAllowsSharedCacheProxyRevalidateWithAuthorization(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Use(New(Config{
Expiration: 30 * time.Second,
KeyGenerator: func(c fiber.Ctx) string {
return c.Path() + "|proxy-revalidate-auth"
},
}))
var count int
app.Get("/", func(c fiber.Ctx) error {
count++
c.Set(fiber.HeaderCacheControl, "proxy-revalidate, max-age=60")
return c.SendString("proxy" + strconv.Itoa(count))
})
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"))
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "proxy1", string(body))
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, "proxy1", string(body))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_CacheAllowsSharedCacheProxyRevalidateWithAuthorization() do?
Test_CacheAllowsSharedCacheProxyRevalidateWithAuthorization() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is Test_CacheAllowsSharedCacheProxyRevalidateWithAuthorization() defined?
Test_CacheAllowsSharedCacheProxyRevalidateWithAuthorization() is defined in middleware/cache/cache_test.go at line 1734.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free