fetch('http://www.freegamesforyourwebsite.com/feeds/games/?tag=platform&limit=100&format=json', {
method:'GET',
mode:'no-cors',
dataType: 'json',
headers: {
'Accept': 'application/json'
}
}).then(response =>
response.json()).then(addImage).catch(e => requestError(e,'image'));
console.log
SyntaxError: Unexpected end of input
at fetch.then.response ((index):159)
at <anonymous>
I attempted to fetch a JSON file using the Fetch API with CORS enabled. However, when I inspected the request headers in Google developer tools, it showed me the provision request header. Although the preview part displayed the JSON response, the promise after the response could not read the data, resulting in the error mentioned in the console log above. The URL I fetched is open source and can be used by anyone.
Any assistance would be greatly appreciated.