vcrpy icon indicating copy to clipboard operation
vcrpy copied to clipboard

Changed how json is retrieved from kwargs, updated tests [aiohttp]

Open bkwi opened this issue 4 years ago • 0 comments
trafficstars

This PR fixes https://github.com/kevin1024/vcrpy/issues/507

Current implementation works only when we send requests using session.request("POST", url, json={'a': 1}). When session.post(url, **kwargs) is used, kwargs will look like this:

{'data': None, 'json': {'a': 1}}

When using session.post/session.put/session.put, 'data' will always be present in kwargs (source)

This is where data = kwargs.get("data", kwargs.get("json")) retrieves None value and why request body ends up to be empty in saved cassette.

I also updated tests to cover this issue.

bkwi avatar Jan 25 '21 13:01 bkwi