1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #27863 -- Added support for the SameSite cookie flag.

Thanks Alex Gaynor for contributing to the patch.
This commit is contained in:
Alex Gaynor
2018-04-13 20:58:31 -04:00
committed by Tim Graham
parent 13efbb233a
commit 9a56b4b13e
16 changed files with 134 additions and 5 deletions

View File

@@ -746,6 +746,11 @@ class CookieTests(unittest.TestCase):
# document.cookie parses whitespace.
self.assertEqual(parse_cookie(' = b ; ; = ; c = ; '), {'': 'b', 'c': ''})
def test_samesite(self):
c = SimpleCookie('name=value; samesite=lax; httponly')
self.assertEqual(c['name']['samesite'], 'lax')
self.assertIn('SameSite=lax', c.output())
def test_httponly_after_load(self):
c = SimpleCookie()
c.load("name=val")