axios-cookiejar-support

axios post request to send form data

六眼飞鱼酱① 提交于 2019-11-26 10:15:16
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: 'Flintstone@gmail.com' } axios({ method: 'post', url: '/addUser', data: body }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); Browser Response: If I set headers as: headers:{ Content-Type:'multipart/form-data' } The request throws the error Error in posting multipart/form-data. Content

axios post request to send form data

烂漫一生 提交于 2019-11-26 01:35:57
问题 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: \'Flintstone@gmail.com\' } axios({ method: \'post\', url: \'/addUser\', data: body }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); Browser Response: If I set headers as: headers:{