vcrpy icon indicating copy to clipboard operation
vcrpy copied to clipboard

Fix an issue with aiohttp, related posting json

Open markis opened this issue 2 years ago • 4 comments

Issue

There is an issue with aiohttp, when a developer sends a json kwarg it is overwritten by the data kwarg. In aiohttp the data kwarg is set to None by default and VCR will always default to None.

Resolution

We should change the kwargs check to check for the json key first and fall back to data. Because data is defaulted and will always exist. But json doesn't always exist.

fixes: #762

markis avatar Sep 13 '23 18:09 markis

I think this might not be the final fix to this issue. When I apply it, the results I get for the body section comes in unrolled as more YAML, instead of being represented as a JSON string line.

I.e. when I POST a JSON body like this one to my app

{"collections": ["fields"], "intersects": {"type": "Point", "coordinates": [12.29683,55.95417]}

...it prints this: Screenshot from 2023-09-28 07-41-21 ...while it should be printing

body: '{"collections": ["fields"], "intersects": {"type": "Point", "coordinates": [12.29683,55.95417]}'

jose-lpa avatar Sep 28 '23 06:09 jose-lpa

I'm not sure about the above issue, but this PR fixes the scenario for me - any chance this can get merged?

akshaya-a avatar Apr 19 '24 05:04 akshaya-a

Same here, can we merge?

QuentinBrosse avatar Jun 24 '24 16:06 QuentinBrosse