# Attributes from the first call are not carried over.
self.set_cookie("a", "e")
+ class SetCookieMaxAgeHandler(RequestHandler):
+ def get(self):
+ self.set_cookie("foo", "bar", max_age=10)
+
return [("/set", SetCookieHandler),
("/get", GetCookieHandler),
("/set_domain", SetCookieDomainHandler),
("/special_char", SetCookieSpecialCharHandler),
("/set_overwrite", SetCookieOverwriteHandler),
+ ("/set_max_age", SetCookieMaxAgeHandler),
]
def test_set_cookie(self):
self.assertEqual(sorted(headers),
["a=e; Path=/", "c=d; Domain=example.com; Path=/"])
+ def test_set_cookie_max_age(self):
+ response = self.fetch("/set_max_age")
+ headers = response.headers.get_list("Set-Cookie")
+ self.assertEqual(sorted(headers),
+ ["foo=bar; Max-Age=10; Path=/"])
+
class AuthRedirectRequestHandler(RequestHandler):
def initialize(self, login_url):