Fix content-length: 0

#454
This commit is contained in:
Kenneth Reitz
2012-02-24 18:42:33 -05:00
parent 83b4081e85
commit ea1d5f3648
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -739,7 +739,7 @@ class Response(object):
raise RuntimeError(
'The content for this response was already consumed')
self._content = bytes().join(self.iter_content()) or None
self._content = bytes().join(self.iter_content()) or bytes()
# print repr(self._content)
except AttributeError:
self._content = None
+6
View File
@@ -795,5 +795,11 @@ class RequestsTestSuite(TestSetup, unittest.TestCase):
s.get(httpbin('redirect', '4'))
def test_empty_response(self):
r = requests.get(httpbin('status', '404'))
r.text
if __name__ == '__main__':
unittest.main()