Instead of client.send() use the client.json() #4097
aravindbalaji-ngp
started this conversation in
Cookbooks
Replies: 1 comment 1 reply
-
Hey @aravindbalaji-ngp! 👋🏻 I am unsure where you saw the syntax using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While testing adonisjs i came across this problem where i need to post data via the tester but in the documentation there were no direct answers. But if you search through the functions available for the client object, you will come across a method called .json() which is supported in adonisjs v5, because in adonisjs v5 client.send() method no longer accepts any data in its params.
Use this:
const response = await client.post('/employees').json(data)
Instead of this:
const response = await client.post('/employees').send(data)
Beta Was this translation helpful? Give feedback.
All reactions