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);
});
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Yes, also I can confirm that my API is receiving the request and sending the response, only on the device the response is always {}
Best AnswerI 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.
Best Answer