From: Ian Cordasco Date: Fri, 26 Jul 2013 15:50:19 +0000 (-0500) Subject: Fixed finally. Also requires updated httpbin.org X-Git-Tag: v2.0~5^2~14^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=972089826e830670cdaec774bb4eb8a3f349b661;p=services%2Fpython-requests.git Fixed finally. Also requires updated httpbin.org --- diff --git a/requests/sessions.py b/requests/sessions.py index 664465d..ca7e217 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -449,6 +449,10 @@ class Session(SessionRedirectMixin): r = dispatch_hook('response', hooks, r, **kwargs) # Persist cookies + if r.history: + # If the hooks create history then we want those cookies too + for resp in r.history: + extract_cookies_to_jar(self.cookies, resp.request, resp.raw) extract_cookies_to_jar(self.cookies, request, r.raw) # Redirect resolving generator. diff --git a/test_requests.py b/test_requests.py index 756bc87..1c58106 100755 --- a/test_requests.py +++ b/test_requests.py @@ -285,7 +285,7 @@ class RequestsTestCase(unittest.TestCase): self.assertEqual(r.status_code, 401) s = requests.session() - s.auth = auth + s.auth = HTTPDigestAuth('user', 'pass') r = s.get(url) self.assertEqual(r.status_code, 200)