Add sameSite property to Cookie interface (#40422)

This commit is contained in:
Alan Christopher Thomas
2019-11-15 18:47:04 -06:00
committed by Pranav Senthilnathan
parent 85eacf4d39
commit ca5bcb9f1c
2 changed files with 3 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ declare module "set-cookie-parser" {
domain?: string;
secure?: boolean;
httpOnly?: boolean;
sameSite?: string;
}
interface CookieMap {

View File

@@ -17,7 +17,7 @@ assert.equal(cookies[0].name, "foo");
assert.equal(cookies[0].value, "bar");
// Optional properties included test
var optionalIncluded = "foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure";
var optionalIncluded = "foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure; SameSite=Strict";
cookies = setCookie(optionalIncluded);
assert.equal(cookies.length, 1);
assert.equal(cookies[0].name, "foo");
@@ -28,6 +28,7 @@ assert.deepEqual(cookies[0].expires, new Date('Tue Jul 01 2025 06:01:11 GMT-0400
assert.equal(cookies[0].maxAge, 1000);
assert.equal(cookies[0].httpOnly, true);
assert.equal(cookies[0].secure, true);
assert.equal(cookies[0].sameSite, "Strict");
// Array of strings test
var arrayOfCookies = ["bam=baz", "foo=bar"];