mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Fix breakage introduced by 8f591682
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user