Home > Software engineering >  How to read the content of an Axios post response?
How to read the content of an Axios post response?

Time:11-10

When I send the same POST request with a cURL command, I get this as response:

{"allowed":[],"error":null}

When I add the POST request in my code and print it with console.log("response: ", response); or console.log("response: ", response.data); , I get this printed

'response: ,[object Object]'

How can I see the content of the response printed in my logs?

CodePudding user response:

You can use console.log("response: ", JSON.stringify(response.data)) to see the content of the object in console.

  • Related