TestCSRFStorageGetError() — fiber Function Reference
Architecture documentation for the TestCSRFStorageGetError() function in csrf_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 50cabb0b_0641_86c0_2a0f_12278c349655["TestCSRFStorageGetError()"] 306a0c68_f5a5_b368_f37a_1419425a8fea["csrf_test.go"] 50cabb0b_0641_86c0_2a0f_12278c349655 -->|defined in| 306a0c68_f5a5_b368_f37a_1419425a8fea cf660e8c_1aed_dfd6_9b61_993899db83b5["newFailingCSRFStorage()"] 50cabb0b_0641_86c0_2a0f_12278c349655 -->|calls| cf660e8c_1aed_dfd6_9b61_993899db83b5 style 50cabb0b_0641_86c0_2a0f_12278c349655 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/csrf/csrf_test.go lines 101–130
func TestCSRFStorageGetError(t *testing.T) {
t.Parallel()
storage := newFailingCSRFStorage()
storage.errs["get|token"] = errors.New("boom")
var captured error
app := fiber.New()
app.Use(New(Config{
Storage: storage,
ErrorHandler: func(_ fiber.Ctx, err error) error {
captured = err
return fiber.ErrTeapot
},
}))
app.Get("/", func(c fiber.Ctx) error {
return c.SendStatus(fiber.StatusOK)
})
req := httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
req.AddCookie(&http.Cookie{Name: ConfigDefault.CookieName, Value: "token"})
resp, err := app.Test(req)
require.NoError(t, err)
require.Equal(t, fiber.StatusTeapot, resp.StatusCode)
require.Error(t, captured)
require.ErrorContains(t, captured, "csrf: failed to fetch token from storage")
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does TestCSRFStorageGetError() do?
TestCSRFStorageGetError() is a function in the fiber codebase, defined in middleware/csrf/csrf_test.go.
Where is TestCSRFStorageGetError() defined?
TestCSRFStorageGetError() is defined in middleware/csrf/csrf_test.go at line 101.
What does TestCSRFStorageGetError() call?
TestCSRFStorageGetError() calls 1 function(s): newFailingCSRFStorage.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free