Fix breakage introduced by 8f591682

This commit is contained in:
Cory Benfield
2015-11-05 18:53:14 +00:00
parent f7e0494130
commit e67cd15bc8
2 changed files with 9 additions and 2 deletions
+2 -2
View File
@@ -398,10 +398,10 @@ class HTTPAdapter(BaseAdapter):
try:
# For Python 2.7+ versions, use buffering of HTTP
# responses
r = conn.getresponse(buffering=True)
r = low_conn.getresponse(buffering=True)
except TypeError:
# For compatibility with Python 2.6 versions and back
r = conn.getresponse()
r = low_conn.getresponse()
resp = HTTPResponse.from_httplib(
r,
+7
View File
@@ -1133,6 +1133,13 @@ class TestRequests(object):
next(r.iter_lines())
assert len(list(r.iter_lines())) == 3
def test_chunked_upload(self, httpbin):
"""Can safely send generators."""
data = (c for c in 'abc')
r = requests.post(httpbin('post'), data=data, stream=True)
assert r.status_code == 200
assert r.request.headers['Transfer-Encoding'] == 'chunked'
class TestContentEncodingDetection(unittest.TestCase):