Skip to content
Myr

r.content is None of there's an invalid response.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes #236

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 4cae63a · Browse files · 2 files+10 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−1 removed

  • other:+10 added−1 removed

2 files+10 added−1 removed

modified:requests/models.py+5 added-1 removed
494 unmodified lines
495 raise RuntimeError('The content for this response was '496 'already consumed')497498 # Read the contents.499 try:499 self._content = self.raw.read()500 self._content = self.raw.read()501 except AttributeError:502 return None503504505 # Decode GZip'd content.506 if 'gzip' in self.headers.get('content-encoding', ''):507 try:508 self._content = decode_gzip(self._content)
16 unmodified lines
modified:test_requests.py+5 added
527 unmodified lines
528 assert not params['a'] in r3.content529 assert params3['b'] in r3.content530 assert params3['c'] in r3.content531532 def test_invalid_content(self):533534 r = requests.get('http://somedomainthatclearlydoesntexistg.com')535 assert r.content == None536537538if __name__ == '__main__':539 unittest.main()