MCPcopy
hub / github.com/gin-gonic/gin / TestContextSetCookie

Function TestContextSetCookie

context_test.go:1008–1013  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1006}
1007
1008func TestContextSetCookie(t *testing.T) {
1009 c, _ := CreateTestContext(httptest.NewRecorder())
1010 c.SetSameSite(http.SameSiteLaxMode)
1011 c.SetCookie("user", "gin", 1, "/", "localhost", true, true)
1012 assert.Equal(t, "user=gin; Path=/; Domain=localhost; Max-Age=1; HttpOnly; Secure; SameSite=Lax", c.Writer.Header().Get("Set-Cookie"))
1013}
1014
1015func TestContextSetCookiePathEmpty(t *testing.T) {
1016 c, _ := CreateTestContext(httptest.NewRecorder())

Callers

nothing calls this directly

Calls 5

CreateTestContextFunction · 0.85
SetSameSiteMethod · 0.80
SetCookieMethod · 0.80
GetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected