Skip to content
Myr

raise RuntimeError when a single streamed request calls *iter methods than once

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

authored by Tim Konick · committed by Tim Konick · parent d28d45a · Browse files · 1 file+6 added−2 removed
This commit

State

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

Diff stats

1 file+6 added−2 removed

  • other:+6 added−2 removed

1 file+6 added−2 removed

modified:requests/models.py+6 added-2 removed
653 unmodified lines
654 yield chunk655656 self._content_consumed = True657658 if self._content_consumed and isinstance(self._content, bool):659 raise RuntimeError(660 'The content for this response was already consumed')661 else:658 # simulate reading small chunks of the content659 reused_chunks = iter_slices(self._content, chunk_size)662 # simulate reading small chunks of the content663 reused_chunks = iter_slices(self._content, chunk_size)664665 stream_chunks = generate()666667 chunks = reused_chunks if self._content_consumed else stream_chunks
155 unmodified lines