I want to make a post request with axios and the data that I must send must be json. I have seen that the content type of my header must be application / json and this is done by default. but when I see the request my called the content type is Content-Type: application / x-www-form-urlencoded
I have tried different ways to set it to change it but it always shows up in the request headers.
The service does the insert but with empty data.
Any idea? I've lost two days with this. Thanks!
const headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers': 'Authorization'
}
const dataJson = JSON.stringify(solicitudObj);
axios.post(state.basePath + 'Api/Solicitud/SaveSolicitud/',
dataJson,
headers
)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
})