Test_Store_getSessionID() — fiber Function Reference
Architecture documentation for the Test_Store_getSessionID() function in store_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD bf5625cc_2fb5_e04d_0f83_27153e29abca["Test_Store_getSessionID()"] 9bbf348a_f496_e909_6f62_6ea1938bfec4["store_test.go"] bf5625cc_2fb5_e04d_0f83_27153e29abca -->|defined in| 9bbf348a_f496_e909_6f62_6ea1938bfec4 style bf5625cc_2fb5_e04d_0f83_27153e29abca fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/session/store_test.go lines 15–67
func Test_Store_getSessionID(t *testing.T) {
t.Parallel()
expectedID := "test-session-id"
// fiber instance
app := fiber.New()
t.Run("from cookie", func(t *testing.T) {
t.Parallel()
// session store
store := NewStore()
// fiber context
ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
defer app.ReleaseCtx(ctx)
// set cookie
ctx.Request().Header.SetCookie(store.Extractor.Key, expectedID)
require.Equal(t, expectedID, store.getSessionID(ctx))
})
t.Run("from header", func(t *testing.T) {
t.Parallel()
// session store
store := NewStore(Config{
Extractor: extractors.FromHeader("session_id"),
})
// fiber context
ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
defer app.ReleaseCtx(ctx)
// set header
ctx.Request().Header.Set(store.Extractor.Key, expectedID)
require.Equal(t, expectedID, store.getSessionID(ctx))
})
t.Run("from url query", func(t *testing.T) {
t.Parallel()
// session store
store := NewStore(Config{
Extractor: extractors.FromQuery("session_id"),
})
// fiber context
ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
defer app.ReleaseCtx(ctx)
// set url parameter
ctx.Request().SetRequestURI(fmt.Sprintf("/path?%s=%s", store.Extractor.Key, expectedID))
require.Equal(t, expectedID, store.getSessionID(ctx))
})
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_Store_getSessionID() do?
Test_Store_getSessionID() is a function in the fiber codebase, defined in middleware/session/store_test.go.
Where is Test_Store_getSessionID() defined?
Test_Store_getSessionID() is defined in middleware/session/store_test.go at line 15.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free