Test_Encrypt_Cookie_Except() — fiber Function Reference
Architecture documentation for the Test_Encrypt_Cookie_Except() function in encryptcookie_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 34d7e1ec_e31b_5095_ccba_bc1f398c9cbb["Test_Encrypt_Cookie_Except()"] ac3bbef3_a1d3_d68b_64fb_619088dde10d["encryptcookie_test.go"] 34d7e1ec_e31b_5095_ccba_bc1f398c9cbb -->|defined in| ac3bbef3_a1d3_d68b_64fb_619088dde10d style 34d7e1ec_e31b_5095_ccba_bc1f398c9cbb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/encryptcookie/encryptcookie_test.go lines 292–335
func Test_Encrypt_Cookie_Except(t *testing.T) {
t.Parallel()
testKey := GenerateKey(32)
app := fiber.New()
app.Use(New(Config{
Key: testKey,
Except: []string{
"test1",
},
}))
app.Get("/", func(c fiber.Ctx) error {
c.Cookie(&fiber.Cookie{
Name: "test1",
Value: "SomeThing",
})
c.Cookie(&fiber.Cookie{
Name: "test2",
Value: "SomeThing",
})
return nil
})
h := app.Handler()
ctx := &fasthttp.RequestCtx{}
ctx.Request.Header.SetMethod(fiber.MethodGet)
h(ctx)
require.Equal(t, 200, ctx.Response.StatusCode())
rawCookie := fasthttp.Cookie{}
rawCookie.SetKey("test1")
require.True(t, ctx.Response.Header.Cookie(&rawCookie), "Get cookie value")
require.Equal(t, "SomeThing", string(rawCookie.Value()))
encryptedCookie := fasthttp.Cookie{}
encryptedCookie.SetKey("test2")
require.True(t, ctx.Response.Header.Cookie(&encryptedCookie), "Get cookie value")
decryptedCookieValue, err := DecryptCookie("test2", string(encryptedCookie.Value()), testKey)
require.NoError(t, err)
require.Equal(t, "SomeThing", decryptedCookieValue)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does Test_Encrypt_Cookie_Except() do?
Test_Encrypt_Cookie_Except() is a function in the fiber codebase, defined in middleware/encryptcookie/encryptcookie_test.go.
Where is Test_Encrypt_Cookie_Except() defined?
Test_Encrypt_Cookie_Except() is defined in middleware/encryptcookie/encryptcookie_test.go at line 292.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free