Open
Description
When using aiohttp and sending a open file as a body (here as io.BytesIO
), when using VCR.py, the initial Request construction is consuming the body, so when aiohttp is getting the data, it's empty as VCR.py don't seek back.
@vcr.use_cassette("issue_vcr_aiohttp.yaml")
def test():
test = io.BytesIO(b"hello")
async with aiohttp.ClientSession() as session:
async with session.post("https://httpbin.org/post", data=test, json=None) as response:
ret = await response.json()
assert ret["data"] == "hello"
Here is a PR #906 that fix this issue, by ensuring the body is seek back after reading.
Metadata
Metadata
Assignees
Labels
No labels
Activity