Test_Middleware_EncryptionErrorDoesNotMaskNextError() — fiber Function Reference
Architecture documentation for the Test_Middleware_EncryptionErrorDoesNotMaskNextError() function in encryptcookie_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 25e851e3_25e0_08b3_0f8a_44eebd8d41c2["Test_Middleware_EncryptionErrorDoesNotMaskNextError()"] ac3bbef3_a1d3_d68b_64fb_619088dde10d["encryptcookie_test.go"] 25e851e3_25e0_08b3_0f8a_44eebd8d41c2 -->|defined in| ac3bbef3_a1d3_d68b_64fb_619088dde10d style 25e851e3_25e0_08b3_0f8a_44eebd8d41c2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/encryptcookie/encryptcookie_test.go lines 149–187
func Test_Middleware_EncryptionErrorDoesNotMaskNextError(t *testing.T) {
t.Parallel()
testKey := GenerateKey(32)
encryptErr := errors.New("encrypt failed")
downstreamErr := errors.New("downstream failed")
var captured error
app := fiber.New(fiber.Config{
ErrorHandler: func(c fiber.Ctx, err error) error {
captured = err
return c.Status(fiber.StatusTeapot).SendString("combined error")
},
})
app.Use(New(Config{
Key: testKey,
Encryptor: func(name, value, _ string) (string, error) {
if name == "test" {
return "", encryptErr
}
return value, nil
},
}))
app.Get("/", func(c fiber.Ctx) error {
c.Cookie(&fiber.Cookie{
Name: "test",
Value: "value",
})
return downstreamErr
})
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
require.NoError(t, err)
require.Equal(t, fiber.StatusTeapot, resp.StatusCode)
require.ErrorIs(t, captured, downstreamErr)
require.ErrorIs(t, captured, encryptErr)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does Test_Middleware_EncryptionErrorDoesNotMaskNextError() do?
Test_Middleware_EncryptionErrorDoesNotMaskNextError() is a function in the fiber codebase, defined in middleware/encryptcookie/encryptcookie_test.go.
Where is Test_Middleware_EncryptionErrorDoesNotMaskNextError() defined?
Test_Middleware_EncryptionErrorDoesNotMaskNextError() is defined in middleware/encryptcookie/encryptcookie_test.go at line 149.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free