From: Ian Cordasco Date: Sat, 15 Mar 2014 15:33:00 +0000 (-0500) Subject: Fix #1960: A Response's history should be a list X-Git-Tag: v2.3.0~21^2~9^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=daf56b3f62f91c7b6ae783ef74ee41ff3c7af89f;p=services%2Fpython-requests.git Fix #1960: A Response's history should be a list --- diff --git a/requests/sessions.py b/requests/sessions.py index 425db22..1e6de8b 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -527,7 +527,6 @@ class Session(SessionRedirectMixin): history.insert(0, r) # Get the last request made r = history.pop() - r.history = tuple(history) return r diff --git a/test_requests.py b/test_requests.py index 17de849..76943f2 100755 --- a/test_requests.py +++ b/test_requests.py @@ -211,6 +211,16 @@ class RequestsTestCase(unittest.TestCase): req_urls = [r.request.url for r in resp.history] assert urls == req_urls + def test_history_is_always_a_list(self): + """ + Show that even with redirects, Response.history is always a list. + """ + resp = requests.get(httpbin('get')) + assert isinstance(resp.history, list) + resp = requests.get(httpbin('redirect/1')) + assert isinstance(resp.history, list) + assert not isinstance(resp.history, tuple) + def test_headers_on_session_with_None_are_not_sent(self): """Do not send headers in Session.headers with None values.""" ses = requests.Session()