Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue with aiohttp, related posting json #768

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

markis
Copy link

@markis markis commented Sep 13, 2023

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 markis changed the title Fix aiohttp Fix an issue with aiohttp, related posting json Sep 13, 2023
@jose-lpa
Copy link

jose-lpa commented Sep 28, 2023

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]}'

@akshaya-a
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AIOHTTP not recording json body
3 participants