mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
raise RuntimeError when a single streamed request calls *iter methods than once
This commit is contained in:
+6
-2
@@ -655,8 +655,12 @@ class Response(object):
|
||||
|
||||
self._content_consumed = True
|
||||
|
||||
# simulate reading small chunks of the content
|
||||
reused_chunks = iter_slices(self._content, chunk_size)
|
||||
if self._content_consumed and isinstance(self._content, bool):
|
||||
raise RuntimeError(
|
||||
'The content for this response was already consumed')
|
||||
else:
|
||||
# simulate reading small chunks of the content
|
||||
reused_chunks = iter_slices(self._content, chunk_size)
|
||||
|
||||
stream_chunks = generate()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user