axios post request to send form data

axios POST request is hitting the url on the controller but setting null values to my POJO class, when I go through developer tools in chrome, the payload contains data. What am I doing wrong? Axios POST Request: var body = { userName: ‘Fred’, userEmail: ‘[email protected]’ } axios({ method: ‘post’, url: ‘/addUser’, data: body }) … Read more

How can I get the status code from an HTTP error in Axios?

This may seem stupid, but I’m trying to get the error data when a request fails in Axios. axios .get(‘foo.com’) .then((response) => {}) .catch((error) => { console.log(error); //Logs a string: Error: Request failed with status code 404 }); Instead of the string, is it possible to get an object with perhaps the status code and … Read more