I want to make a POST request to REST API running on Azure and I want to pass a javascript object with the POST request. But response shows 415 error code Unsupported Media type. I did try changing 'Content Type' to 'Application/json', but I get the same response.
componentDidMount() {
const bodyFormData = new FormData();
bodyFormData.set('id', 30958);
axios({
method: 'post',
url: 'https://example./api/example/GetExamplData',
data: bodyFormData,
config: { headers: {
'Content-Type': 'application/x-www-form-urlencoded',
}}
})
.then((response) => {console.log(response)})
.catch(error => {console.log( 'the error has occured: ' + error) })
}
headersas a standalone property (don't wrap it insideconfig) - Kox