Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Returns either an array of cookie objects or a map of name => cookie object with
* `secure` - indicates that this cookie should only be sent over HTTPs (true or undefined)
* `httpOnly` - indicates that this cookie should *not* be accessible to client-side JavaScript (true or undefined)
* `sameSite` - indicates a cookie ought not to be sent along with cross-site requests (string or undefined)
* `partitioned` - indicates that this cookie could be created in an iframe from a 3rd party domain (true or undefined)

(The output format is loosely based on the input format of https://www.npmjs.com/package/cookie)

Expand Down
2 changes: 2 additions & 0 deletions lib/set-cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ function parseString(setCookieValue, options) {
cookie.httpOnly = true;
} else if (key === "samesite") {
cookie.sameSite = value;
} else if (key === "partitioned") {
cookie.partitioned = true;
} else {
cookie[key] = value;
}
Expand Down
3 changes: 2 additions & 1 deletion test/set-cookie-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("set-cookie-parser", function () {

it("should parse a complex set-cookie header", function () {
var cookieStr =
"foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure";
"foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure; Partitioned";
var actual = setCookie.parse(cookieStr);
var expected = [
{
Expand All @@ -40,6 +40,7 @@ describe("set-cookie-parser", function () {
domain: ".example.com",
secure: true,
httpOnly: true,
partitioned: true,
},
];
assert.deepEqual(actual, expected);
Expand Down