mirror of https://github.com/gin-gonic/gin.git
Compare commits
2 Commits
e7039cb64b
...
1a7a8d5163
Author | SHA1 | Date |
---|---|---|
Ludovico Cavedon | 1a7a8d5163 | |
Ludovico Cavedon | 929794596f |
|
@ -1086,7 +1086,7 @@ func (c *Context) SetCookie(name, value string, maxAge int, path, domain string,
|
|||
}
|
||||
http.SetCookie(c.Writer, &http.Cookie{
|
||||
Name: name,
|
||||
Value: url.QueryEscape(value),
|
||||
Value: value,
|
||||
MaxAge: maxAge,
|
||||
Path: path,
|
||||
Domain: domain,
|
||||
|
|
|
@ -832,6 +832,13 @@ func TestContextSetCookiePathEmpty(t *testing.T) {
|
|||
assert.Equal(t, "user=gin; Path=/; Domain=localhost; Max-Age=1; HttpOnly; Secure; SameSite=Lax", c.Writer.Header().Get("Set-Cookie"))
|
||||
}
|
||||
|
||||
func TestContextSetCookieWithSpace(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
c.SetSameSite(http.SameSiteLaxMode)
|
||||
c.SetCookie("user", "gin test", 1, "/", "localhost", true, true)
|
||||
assert.Equal(t, "user=\"gin test\"; Path=/; Domain=localhost; Max-Age=1; HttpOnly; Secure; SameSite=Lax", c.Writer.Header().Get("Set-Cookie"))
|
||||
}
|
||||
|
||||
func TestContextGetCookie(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
c.Request, _ = http.NewRequest("GET", "/get", nil)
|
||||
|
|
Loading…
Reference in New Issue