diff --git a/index.js b/index.js index 9c3d07d..991a9f8 100644 --- a/index.js +++ b/index.js @@ -213,6 +213,10 @@ function serialize(name, val, options) { throw new TypeError('option sameSite is invalid'); } } + + if (opt.partitioned) { + str += '; Partitioned'; + } return str; } diff --git a/test/serialize.js b/test/serialize.js index 6e34590..2bc734e 100644 --- a/test/serialize.js +++ b/test/serialize.js @@ -193,4 +193,14 @@ describe('cookie.serialize(name, value, options)', function () { assert.equal(cookie.serialize('foo', 'bar', { secure: false }), 'foo=bar') }) }) + + describe('with "partitioned" option', function () { + it('should include partitioned flag when true', function () { + assert.equal(cookie.serialize('foo', 'bar', { partitioned: true }), 'foo=bar; Partitioned') + }) + + it('should not include partitioned flag when false', function () { + assert.equal(cookie.serialize('foo', 'bar', { partitioned: false }), 'foo=bar') + }) + }) })