kevin1024 / vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AIOHTTP not recording json body

cadlagtrader opened this issue · comments

commented

Hello - thanks for this great library !

I spotted an issue with 'data' vs 'json' in aiohttp_stubs vcr_request. When only json is present, vcrpy fails to record

The default fallback (from data to json) works when data is missing in the kwargs, but recent versions of aiohttp _request seems to have data = None when json is present (see @https://github.com/aio-libs/aiohttp/blob/40d8eb88de7674efbd6b001d04c0b91dad1f42d1/aiohttp/client.py#L375C11-L375C11)

I noticed the same thing. I think the solution is for vcrpy to pull json first and fallback to data. I have a PR with the change here: #768