When i try to do a fetch API call in POST with React native (expo SDK 37) using fetch and FormData, everything works perfectly on IOS but it makes a Network error on Android: [TypeError: Network request failed]. I have the same error (network error) if I use axios instead of fetch.
If I replace the formData with empty a {}, it works. I've checked on an emulator and on physical devices (with various Android versions), and i tried to play with headers but no result. And my API has a valide let's encrypt certificate
let url = 'https://my-prod-server/webservice';
let formData = new FormData();
formData.append('test1','test1');
formData.append('test2','test2');
let request = await fetch(url, {
headers: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
},
method: 'POST',
body: formData,
})
.then(response => response.json())
.catch(error => console.log('API ERROR: ', error));
return request;