fix: change cookie default from NO_RESTRICTION to LAX_MODE (#31800)

* fix: change default from NO_RESTRICTION to LAX_MODE

* chore: update cookie docs, redirect tests
This commit is contained in:
Keeley Hammond 2021-11-15 07:20:04 -08:00 committed by GitHub
commit bf7b245fa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View file

@ -759,14 +759,18 @@ describe('net module', () => {
const cookieLocalVal = `${Date.now()}-local`;
const localhostUrl = serverUrl.replace('127.0.0.1', 'localhost');
expect(localhostUrl).to.not.equal(serverUrl);
// cookies with lax or strict same-site settings will not
// persist after redirects. no_restriction must be used
await Promise.all([
sess.cookies.set({
url: serverUrl,
name: 'wild_cookie',
sameSite: 'no_restriction',
value: cookie127Val
}), sess.cookies.set({
url: localhostUrl,
name: 'wild_cookie',
sameSite: 'no_restriction',
value: cookieLocalVal
})
]);