Closed eduardo-boutiquenumerique closed 6 months ago
why do you think that the data should be json ?
here is a python example with native request:
import requests
r = requests.post("https://example.com", data={"request": "abcdef"})
here is the request data attached to r
:
r.request.body
PyDev console: starting.
'request=abcdef'
Thanks for you quick reply.
I've got 2 reasons to think it should be a json:
What do you think ?
the point here is that we just mock requests
, we do not invent new stuff
as you see my example above, that the request without responses
library, and the output that you see with it. Response that is mocked with responses
complies with it
I see. You are right. Thanks a lot.
My mistake what that I was using data keyword instead of json in requests.post.
I'll close this issue.
Describe the bug
When trying to assert that a post call was made with certain data (json) as in the docs , the body attribute that should return un json in strung format is returning a url formated data as it was a query parameter in a get call.
Additional context
No response
Version of
responses
0.24.1
Steps to Reproduce
Expected Result
printing should be: '{"request": "abcdef"}' and the asserting should not raise an error
Actual Result
printing is request=abcdef assertion is raising an error in json.loads json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)