@@ -65,9 +65,18 @@ class GetCookieHandler(RequestHandler):
65
65
def get (self ):
66
66
self .write (self .get_cookie ("foo" ))
67
67
68
+ class SetCookieDomainHandler (RequestHandler ):
69
+ def get (self ):
70
+ # unicode domain and path arguments shouldn't break things
71
+ # either (see bug #285)
72
+ self .set_cookie ("unicode_args" , "blah" , domain = u"foo.com" ,
73
+ path = u"/foo" )
74
+
75
+
68
76
return Application ([
69
77
("/set" , SetCookieHandler ),
70
- ("/get" , GetCookieHandler )])
78
+ ("/get" , GetCookieHandler ),
79
+ ("/set_domain" , SetCookieDomainHandler )])
71
80
72
81
def test_set_cookie (self ):
73
82
response = self .fetch ("/set" )
@@ -80,6 +89,11 @@ def test_get_cookie(self):
80
89
response = self .fetch ("/get" , headers = {"Cookie" : "foo=bar" })
81
90
self .assertEqual (response .body , b ("bar" ))
82
91
92
+ def test_set_cookie_domain (self ):
93
+ response = self .fetch ("/set_domain" )
94
+ self .assertEqual (response .headers .get_list ("Set-Cookie" ),
95
+ ["unicode_args=blah; Domain=foo.com; Path=/foo" ])
96
+
83
97
class AuthRedirectRequestHandler (RequestHandler ):
84
98
def initialize (self , login_url ):
85
99
self .login_url = login_url
0 commit comments