@types/cookie - Add 'none' as a valid value for sameSite of the CookieSerializeOptions (#35570)

* @types/cookie - Add 'none' as a valid value for sameSite of the CookieSerializeOptions

* @types/cookie - Add documentation for 'none' SameSite option
This commit is contained in:
Tyrone Dougherty 2019-05-25 06:54:43 +10:00 committed by Ryan Cavanaugh
parent ebf0e7e257
commit 64d5f9c5f7
2 changed files with 7 additions and 2 deletions

View File

@ -5,6 +5,8 @@ function test_serialize(): void {
retVal = cookie.serialize('foo', 'bar');
retVal = cookie.serialize('foo', 'bar', { httpOnly: true });
retVal = cookie.serialize('foo', 'bar', { sameSite: 'none' });
retVal = cookie.serialize('foo', 'bar', { sameSite: 'lax' });
}
function test_parse(): void {
@ -22,7 +24,8 @@ function test_options(): void {
maxAge: 200,
domain: 'example.com',
secure: false,
httpOnly: false
httpOnly: false,
sameSite: 'strict'
};
const parseOptios: cookie.CookieParseOptions = {

View File

@ -71,8 +71,10 @@ export interface CookieSerializeOptions {
* enforcement.
* - `'strict'` will set the `SameSite` attribute to Strict for strict same
* site enforcement.
* - `'none'` will set the SameSite attribute to None for an explicit
* cross-site cookie.
*/
sameSite?: boolean | 'lax' | 'strict';
sameSite?: boolean | 'lax' | 'strict' | 'none';
/**
* Specifies the boolean value for the `Secure` `Set-Cookie` attribute. When
* truthy, the `Secure` attribute is set, otherwise it is not. By default,