I am trying to send a Post request with axios to a WebApi on my server, testing the API with PostMan the API accepts and works fine.
But on my React Native App, when I send the axios.post it returns "Error: Request failed with status code 415".
When I send the post with the postData it Returns Error:Network Error
, and when
I send the way bellow it returns Error 415
.
I made a lot of searches but could not solve this. Can someone give a hand on this? Bellow is my js code.
let postData = new FormData();
postData.append('file',{ uri: response.uri });
postData.append('auditid',auditID);
//axios.post("http://172.16.0.10:8081/api/auditpicture/", postData,{
axios.post("http://172.16.0.10:8081/api/auditpicture/",{
headers: {
"Content-Type": 'multipart/form-data; boundary=${formData._boundary}',
}
,
body:
[{
file:response.uri,
auditid:auditID
}]
}).then(response=> {
console.log(response.data)
}).catch(error=>{
console.log(error);
})