Test_CachePrivateDirectiveWithAuthorization() — fiber Function Reference
Architecture documentation for the Test_CachePrivateDirectiveWithAuthorization() function in cache_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 118f4b2c_a42d_0935_4de6_d886bb1cd64c["Test_CachePrivateDirectiveWithAuthorization()"] 8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"] 118f4b2c_a42d_0935_4de6_d886bb1cd64c -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656 style 118f4b2c_a42d_0935_4de6_d886bb1cd64c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/cache/cache_test.go lines 2872–2902
func Test_CachePrivateDirectiveWithAuthorization(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Use(New())
var count int
app.Get("/", func(c fiber.Ctx) error {
count++
c.Set(fiber.HeaderCacheControl, "private")
return c.SendString(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, cacheUnreachable, resp.Header.Get("X-Cache"))
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "1", 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, cacheUnreachable, resp.Header.Get("X-Cache"))
body, err = io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "2", string(body))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_CachePrivateDirectiveWithAuthorization() do?
Test_CachePrivateDirectiveWithAuthorization() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is Test_CachePrivateDirectiveWithAuthorization() defined?
Test_CachePrivateDirectiveWithAuthorization() is defined in middleware/cache/cache_test.go at line 2872.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free