Skip to content

Commit 48890fd

Browse files
committed
address review comments
1 parent a5d8b51 commit 48890fd

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
coverage.coverprofile
2-
3-
# IDE Metadata
4-
.idea
5-
.vscode

cookie_go111_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func TestNewCookieFromOptionsSameSite(t *testing.T) {
1717
{http.SameSiteDefaultMode},
1818
{http.SameSiteLaxMode},
1919
{http.SameSiteStrictMode},
20+
{http.SameSiteNoneMode},
2021
}
2122
for i, v := range tests {
2223
options := &Options{

sessions_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ func TestFlashes(t *testing.T) {
4040

4141
store := NewCookieStore([]byte("secret-key"))
4242

43-
if store.Options.SameSite != http.SameSiteLaxMode {
44-
t.Fatalf("cookie store error: default same site is not set to Lax")
43+
if store.Options.SameSite != http.SameSiteNoneMode {
44+
t.Fatalf("cookie store error: default same site is not set to None")
4545
}
4646

4747
// Round 1 ----------------------------------------------------------------
@@ -72,8 +72,8 @@ func TestFlashes(t *testing.T) {
7272
t.Fatal("No cookies. Header:", hdr)
7373
}
7474

75-
if !strings.Contains(cookies[0], "SameSite=Lax") {
76-
t.Fatal("Set-Cookie does not contains SameSite=Lax, cookie string:", cookies[0])
75+
if !strings.Contains(cookies[0], "SameSite=None") || !strings.Contains(cookies[0], "Secure") {
76+
t.Fatal("Set-Cookie does not contains SameSite=None with Secure, cookie string:", cookies[0])
7777
}
7878

7979
if _, err = store.Get(req, "session:key"); err.Error() != "sessions: invalid character in cookie name: session:key" {

store.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ func NewCookieStore(keyPairs ...[]byte) *CookieStore {
5656
Options: &Options{
5757
Path: "/",
5858
MaxAge: 86400 * 30,
59-
SameSite: http.SameSiteLaxMode,
59+
SameSite: http.SameSiteNoneMode,
60+
Secure: true,
6061
},
6162
}
6263

0 commit comments

Comments
 (0)