Decode response URL to a unicode string.
authorJohannes Gorset <jgorset@gmail.com>
Thu, 19 Jan 2012 23:34:06 +0000 (00:34 +0100)
committerJohannes Gorset <jgorset@gmail.com>
Thu, 19 Jan 2012 23:34:44 +0000 (00:34 +0100)
Fixes #182

requests/models.py
test_requests.py

index 564281f..f407751 100644 (file)
@@ -187,7 +187,7 @@ class Request(object):
             if is_error:
                 response.error = resp
 
-            response.url = self.full_url
+            response.url = self.full_url.decode('utf-8')
 
             return response
 
index dab3dd4..172b1ed 100755 (executable)
@@ -294,6 +294,16 @@ class RequestsTestSuite(unittest.TestCase):
         r = requests.get(httpbin('gzip'))
         r.content.decode('ascii')
 
+    def test_response_has_unicode_url(self):
+
+        for service in SERVICES:
+
+            url = service('get')
+
+            response = requests.get(url)
+
+            self.assertIsInstance(response.url, unicode)
+
 
     def test_unicode_get(self):