@@ -65,6 +65,18 @@ var writeSetCookiesTests = []struct {
65
65
& Cookie {Name : "cookie-11" , Value : "invalid-expiry" , Expires : time .Date (1600 , 1 , 1 , 1 , 1 , 1 , 1 , time .UTC )},
66
66
"cookie-11=invalid-expiry" ,
67
67
},
68
+ {
69
+ & Cookie {Name : "cookie-12" , Value : "samesite-default" , SameSite : SameSiteDefaultMode },
70
+ "cookie-12=samesite-default; SameSite" ,
71
+ },
72
+ {
73
+ & Cookie {Name : "cookie-13" , Value : "samesite-lax" , SameSite : SameSiteLaxMode },
74
+ "cookie-13=samesite-lax; SameSite=Lax" ,
75
+ },
76
+ {
77
+ & Cookie {Name : "cookie-14" , Value : "samesite-strict" , SameSite : SameSiteStrictMode },
78
+ "cookie-14=samesite-strict; SameSite=Strict" ,
79
+ },
68
80
// The "special" cookies have values containing commas or spaces which
69
81
// are disallowed by RFC 6265 but are common in the wild.
70
82
{
@@ -241,6 +253,33 @@ var readSetCookiesTests = []struct {
241
253
Raw : "ASP.NET_SessionId=foo; path=/; HttpOnly" ,
242
254
}},
243
255
},
256
+ {
257
+ Header {"Set-Cookie" : {"samesitedefault=foo; SameSite" }},
258
+ []* Cookie {{
259
+ Name : "samesitedefault" ,
260
+ Value : "foo" ,
261
+ SameSite : SameSiteDefaultMode ,
262
+ Raw : "samesitedefault=foo; SameSite" ,
263
+ }},
264
+ },
265
+ {
266
+ Header {"Set-Cookie" : {"samesitelax=foo; SameSite=Lax" }},
267
+ []* Cookie {{
268
+ Name : "samesitelax" ,
269
+ Value : "foo" ,
270
+ SameSite : SameSiteLaxMode ,
271
+ Raw : "samesitelax=foo; SameSite=Lax" ,
272
+ }},
273
+ },
274
+ {
275
+ Header {"Set-Cookie" : {"samesitestrict=foo; SameSite=Strict" }},
276
+ []* Cookie {{
277
+ Name : "samesitestrict" ,
278
+ Value : "foo" ,
279
+ SameSite : SameSiteStrictMode ,
280
+ Raw : "samesitestrict=foo; SameSite=Strict" ,
281
+ }},
282
+ },
244
283
// Make sure we can properly read back the Set-Cookie headers we create
245
284
// for values containing spaces or commas:
246
285
{
0 commit comments