1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

fix: usage of io-like interface with VCR.py (#906)

* fix: usage of io-like interface with VCR.py

* Update tests/integration/test_aiohttp.py

Co-authored-by: Jair Henrique <jair.henrique@gmail.com>

---------

Co-authored-by: Jair Henrique <jair.henrique@gmail.com>
This commit is contained in:
Mathieu Virbel
2025-12-05 14:45:49 -06:00
committed by GitHub
parent e8818e5c0b
commit 3f78330c1e
2 changed files with 23 additions and 1 deletions

View File

@@ -20,7 +20,12 @@ class Request:
self._was_file = hasattr(body, "read")
self._was_iter = _is_nonsequence_iterator(body)
if self._was_file:
self.body = body.read()
if hasattr(body, "tell"):
tell = body.tell()
self.body = body.read()
body.seek(tell)
else:
self.body = body.read()
elif self._was_iter:
self.body = list(body)
else: