08-31-2019 18:51 - edited 08-31-2019 18:52
08-31-2019 18:51 - edited 08-31-2019 18:52
I am using fetch on expternal API and seem to be receiving empty response (Not empty body but fully empty resonse)
const data = {'id': 'id'};
var options = {
method: 'POST',
body: JSON.stringify(data),
json: true,
headers: {
'cache-control': 'no-cache',
'Content-Type': 'application/json'
},
};
fetch(url, options)
.then(function (response) {
console.log(response);
})
.catch(function (err) {
console.log("Error : " + err);
});
09-10-2019 01:47
09-10-2019 01:47
Can you confirm that you requested the `access_internet` permission?
09-11-2019 08:31
09-11-2019 08:31
Yes, also I can confirm that my API is receiving the request and sending the response, only on the device the response is always {}
05-12-2020 00:14
05-12-2020 00:14
I have the exact same problem. I tried using the fetch polyfill from https://github.com/github/fetch and I get a slightly better result, I get correct looking headers in the response, with content-length indicating there should be data, but the response.json() call still returns an empty object.