Able to fetch data through axios #172
hkhattabii
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
@hkhattabii Hmm, do you have a MRE or open-source repo where I can see some code demonstrating the issue? The request body your client code receives can be manipulated with |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Issue
When I test nextjs api, the body that I send is always undefined if I don't Stringify at test level and parse at api level.
It's working, but when I don't make test, the JSON.parse() stay there and I also have to check wether the request body is stringified or not.
From the test I have to stringify my body, otherwise it is undefined on the api
I want to send the request through a client such as postman or web browser I am getting this exception becuase it tries to parse a plain object instead of string.
If I want to use both at test level and client level I have to check if I can parse or not the body
The solution
Access to "axios" parameter in the test callback to send body as plain object and avoid to stringify data
Beta Was this translation helpful? Give feedback.
All reactions