Skip to content
Advertisement

How to read the content of an Axios post response?

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?

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement