mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #27863 -- Added support for the SameSite cookie flag.
Thanks Alex Gaynor for contributing to the patch.
This commit is contained in:
parent
13efbb233a
commit
9a56b4b13e
16 changed files with 134 additions and 5 deletions
|
@ -660,6 +660,16 @@ class SessionMiddlewareTests(TestCase):
|
|||
str(response.cookies[settings.SESSION_COOKIE_NAME])
|
||||
)
|
||||
|
||||
@override_settings(SESSION_COOKIE_SAMESITE='Strict')
|
||||
def test_samesite_session_cookie(self):
|
||||
request = RequestFactory().get('/')
|
||||
response = HttpResponse()
|
||||
middleware = SessionMiddleware()
|
||||
middleware.process_request(request)
|
||||
request.session['hello'] = 'world'
|
||||
response = middleware.process_response(request, response)
|
||||
self.assertEqual(response.cookies[settings.SESSION_COOKIE_NAME]['samesite'], 'Strict')
|
||||
|
||||
@override_settings(SESSION_COOKIE_HTTPONLY=False)
|
||||
def test_no_httponly_session_cookie(self):
|
||||
request = RequestFactory().get('/')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue