mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #33562 -- Made HttpResponse.set_cookie() support timedelta for the max_age argument.
This commit is contained in:
committed by
Mariusz Felisiak
parent
1882f6567d
commit
ae2da5ba65
@@ -71,6 +71,11 @@ class SetCookieTests(SimpleTestCase):
|
||||
response.set_cookie("max_age", max_age=10.6)
|
||||
self.assertEqual(response.cookies["max_age"]["max-age"], 10)
|
||||
|
||||
def test_max_age_timedelta(self):
|
||||
response = HttpResponse()
|
||||
response.set_cookie("max_age", max_age=timedelta(hours=1))
|
||||
self.assertEqual(response.cookies["max_age"]["max-age"], 3600)
|
||||
|
||||
def test_httponly_cookie(self):
|
||||
response = HttpResponse()
|
||||
response.set_cookie("example", httponly=True)
|
||||
|
||||
Reference in New Issue
Block a user