Test case for requests getting stuck on post redirect with seekable stream

This commit is contained in:
tzickel
2016-08-24 23:14:35 +03:00
committed by Nate Prewitt
parent 9849c27b70
commit 38dd089c5f
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ coverage==4.0.3
decorator==4.0.9
docutils==0.12
Flask==0.10.1
httpbin==0.4.1
httpbin==0.5.0
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
+16
View File
@@ -165,6 +165,22 @@ class TestRequests:
assert r.history[0].status_code == 302
assert r.history[0].is_redirect
def test_HTTP_307_ALLOW_REDIRECT_POST(self, httpbin):
parts = urlparse(httpbin('post'))
url = "HTTP://" + parts.netloc + parts.path
r = requests.post(httpbin('redirect-to'), data='test', params={'url': url, 'status_code': 307})
assert r.status_code == 200
assert r.history[0].status_code == 307
assert r.history[0].is_redirect
def test_HTTP_307_ALLOW_REDIRECT_POST_WITH_SEEKABLE(self, httpbin):
parts = urlparse(httpbin('post'))
url = "HTTP://" + parts.netloc + parts.path
r = requests.post(httpbin('redirect-to'), data=io.BytesIO(b'test'), params={'url': url, 'status_code': 307})
assert r.status_code == 200
assert r.history[0].status_code == 307
assert r.history[0].is_redirect
def test_HTTP_302_TOO_MANY_REDIRECTS(self, httpbin):
try:
requests.get(httpbin('relative-redirect', '50'))