I have wrapped my react app with capacitor 3.0. Using Axios 0.21.4 version. Api calls are working as expected in Web and android. However in IOS, the request reaches the server and server sends the correct response back. The response is being caught in catch block of axios as Network Error which consists of the request data i sent to server.
const apiurl = "https://xxxx.xxx.com/receiptReader";
const upload = async (e) => {
const frmdata = new FormData();
frmdata.append("file", document.getElementById("a").files[0]);
await axios({
method: "post",
url: apiurl,
data: frmdata,
headers: {
Authorization: "ccccc@hotmail.com",
"Content-Type": "multipart/form-data",
},
}).then((response) => {
console.log(response);
setHi(JSON.stringify(response));
})
.catch((error) => {
console.log(error.message);
console.log("error");
});
};
I didnt change any config for ios. Its the same given with capacitor. Any help would be absolutely grateful in this regard.