mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-19 15:57:48 +08:00
Update context_test.go
This commit is contained in:
parent
aeb5aa0659
commit
58604c2d80
@ -602,13 +602,13 @@ func TestContextPostFormMultipart(t *testing.T) {
|
|||||||
|
|
||||||
func TestContextSetCookie(t *testing.T) {
|
func TestContextSetCookie(t *testing.T) {
|
||||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||||
c.SetCookie("user", "gin", 1, "/", "localhost", "Lax", true, true)
|
c.SetCookie("user", "gin", 1, "/", "localhost", http.SameSiteLaxMode, true, true)
|
||||||
assert.Equal(t, "user=gin; Path=/; Domain=localhost; Max-Age=1; SameSite=Lax; HttpOnly; Secure", c.Writer.Header().Get("Set-Cookie"))
|
assert.Equal(t, "user=gin; Path=/; Domain=localhost; Max-Age=1; SameSite=Lax; HttpOnly; Secure", c.Writer.Header().Get("Set-Cookie"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContextSetCookiePathEmpty(t *testing.T) {
|
func TestContextSetCookiePathEmpty(t *testing.T) {
|
||||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||||
c.SetCookie("user", "gin", 1, "", "localhost", "Lax", true, true)
|
c.SetCookie("user", "gin", 1, "", "localhost", http.SameSiteLaxMode, true, true)
|
||||||
assert.Equal(t, "user=gin; Path=/; Domain=localhost; Max-Age=1; SameSite=Lax; HttpOnly; Secure", c.Writer.Header().Get("Set-Cookie"))
|
assert.Equal(t, "user=gin; Path=/; Domain=localhost; Max-Age=1; SameSite=Lax; HttpOnly; Secure", c.Writer.Header().Get("Set-Cookie"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user