mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-29613: Added support for SameSite cookies (GH-6413)
* bpo-29613: Added support for SameSite cookies Implemented as per draft https://tools.ietf.org/html/draft-west-first-party-cookies-07 * Documented SameSite And suggestions by members. * Missing space :( * Updated News and contributors * Added version changed details. * Fix in documentation * fix in documentation * Clubbed test cases for same attribute into single. * Updates * Style nits + expand tests * review feedback
This commit is contained in:
parent
1d80a56173
commit
c87eb09d2e
5 changed files with 25 additions and 0 deletions
|
@ -121,6 +121,19 @@ class CookieTests(unittest.TestCase):
|
|||
self.assertEqual(C.output(),
|
||||
'Set-Cookie: Customer="WILE_E_COYOTE"; HttpOnly; Secure')
|
||||
|
||||
def test_samesite_attrs(self):
|
||||
samesite_values = ['Strict', 'Lax', 'strict', 'lax']
|
||||
for val in samesite_values:
|
||||
with self.subTest(val=val):
|
||||
C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
|
||||
C['Customer']['samesite'] = val
|
||||
self.assertEqual(C.output(),
|
||||
'Set-Cookie: Customer="WILE_E_COYOTE"; SameSite=%s' % val)
|
||||
|
||||
C = cookies.SimpleCookie()
|
||||
C.load('Customer="WILL_E_COYOTE"; SameSite=%s' % val)
|
||||
self.assertEqual(C['Customer']['samesite'], val)
|
||||
|
||||
def test_secure_httponly_false_if_not_present(self):
|
||||
C = cookies.SimpleCookie()
|
||||
C.load('eggs=scrambled; Path=/bacon')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue