Update context_test.go

This commit is contained in:
thinkerou 2020-01-20 10:36:47 +08:00 committed by GitHub
parent aeb5aa0659
commit 58604c2d80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -602,13 +602,13 @@ func TestContextPostFormMultipart(t *testing.T) {
func TestContextSetCookie(t *testing.T) {
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"))
}
func TestContextSetCookiePathEmpty(t *testing.T) {
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"))
}