mirror of
https://github.com/kennethreitz/requests3.git
synced 2026-06-05 23:10:16 +00:00
Update on Tracking Previous Requests
Modified the comment in sessions.py and rewrote the test in test_requests.py
This commit is contained in:
@@ -97,7 +97,7 @@ class SessionRedirectMixin(object):
|
||||
prepared_request = req.copy()
|
||||
|
||||
if i > 0:
|
||||
#create deep copy of the history and keep track of redirects
|
||||
#update history and keep track of redirects
|
||||
hist.append(resp)
|
||||
new_hist = list(hist)
|
||||
resp.history = new_hist
|
||||
|
||||
+4
-3
@@ -976,10 +976,11 @@ class RequestsTestCase(unittest.TestCase):
|
||||
|
||||
def test_requests_history_is_saved(self):
|
||||
r = requests.get('https://httpbin.org/redirect/5')
|
||||
count = 0
|
||||
total = r.history[-1].history
|
||||
i = 0
|
||||
for item in r.history:
|
||||
assert len(item.history) == count
|
||||
count = count + 1
|
||||
assert item.history == total[0:i]
|
||||
i=i+1
|
||||
|
||||
|
||||
class TestContentEncodingDetection(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user