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

This commit is contained in:
Tim Konick
2014-09-22 12:04:29 -04:00
parent d28d45af91
commit fdf932c61c
+6 -2
View File
@@ -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()