Skip to content
Myr

Fix #1960: A Response's history should be a list

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Ian Cordasco · committed by Ian Cordasco · parent 110048f · Browse files · 2 files+10 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−1 removed

  • other:+10 added−1 removed

2 files+10 added−1 removed

modified:requests/sessions.py-1 removed
525 unmodified lines
526 # Insert the first (original) request at the start527 history.insert(0, r)528 # Get the last request made529 r = history.pop()530 r.history = tuple(history)530531 return r532533 def get_adapter(self, url):
37 unmodified lines
modified:test_requests.py+10 added
209 unmodified lines
210 urls = [r.url for r in resp.history]211 req_urls = [r.request.url for r in resp.history]212 assert urls == req_urls213214 def test_history_is_always_a_list(self):215 """216 Show that even with redirects, Response.history is always a list.217 """218 resp = requests.get(httpbin('get'))219 assert isinstance(resp.history, list)220 resp = requests.get(httpbin('redirect/1'))221 assert isinstance(resp.history, list)222 assert not isinstance(resp.history, tuple)223224 def test_headers_on_session_with_None_are_not_sent(self):225 """Do not send headers in Session.headers with None values."""226 ses = requests.Session()227 ses.headers['Accept-Encoding'] = None
974 unmodified lines