mirror of
https://github.com/gin-gonic/gin.git
synced 2026-07-05 01:31:21 +08:00
Compare commits
3 Commits
d483eee44c
...
069a7de2e4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
069a7de2e4 | ||
|
|
e88fc8927a | ||
|
|
929794596f |
5
.github/workflows/trivy-scan.yml
vendored
5
.github/workflows/trivy-scan.yml
vendored
@ -8,9 +8,8 @@ on:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
# Run every 3 months (quarterly) on the 1st day at 00:00 UTC
|
||||
# Months: January (1), April (4), July (7), October (10)
|
||||
- cron: '0 0 1 1,4,7,10 *'
|
||||
# Run daily at 00:00 UTC
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
|
||||
permissions:
|
||||
|
||||
@ -1094,7 +1094,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,
|
||||
|
||||
@ -1002,6 +1002,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(http.MethodGet, "/get", nil)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user