MCPcopy
hub / github.com/gofiber/fiber / Test_Ctx_Cookie_DefaultPath

Function Test_Ctx_Cookie_DefaultPath

ctx_test.go:1609–1626  ·  view source on GitHub ↗

go test -run Test_Ctx_Cookie_DefaultPath

(t *testing.T)

Source from the content-addressed store, hash-verified

1607
1608// go test -run Test_Ctx_Cookie_DefaultPath
1609func Test_Ctx_Cookie_DefaultPath(t *testing.T) {
1610 t.Parallel()
1611 app := New()
1612 c := app.AcquireCtx(&fasthttp.RequestCtx{})
1613
1614 ck := &Cookie{
1615 Name: "p",
1616 Value: "v",
1617 // Path intentionally empty to verify defaulting
1618 }
1619
1620 c.Res().Cookie(ck)
1621 require.Equal(
1622 t,
1623 "p=v; path=/; SameSite=Lax",
1624 c.Res().Get(HeaderSetCookie),
1625 )
1626}
1627
1628// go test -run Test_Ctx_Cookie_MaxAgeOnly
1629func Test_Ctx_Cookie_MaxAgeOnly(t *testing.T) {

Callers

nothing calls this directly

Calls 5

AcquireCtxMethod · 0.80
NewFunction · 0.70
CookieMethod · 0.65
ResMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected