When I make a GET request on Postman, it successfully makes the GET request:
But when I do a GET fetch in ReactJS:
var data = {
'Content-Type': 'application/json',
'vin': 'TESTVIN1234567890'
}
var myInit = {
method: 'GET',
mode: 'no-cors',
header: data,
};
fetch('http://www.localhost:8080/ota/upload/config/', myInit)
.then(result=>result.json())
.then(body=>{
console.log(body)
});
I get the following error (with Uncaught SyntaxError pointing to the line : .then(result=>result.json())):
So I tested to see if fetch is correct with http://jsonplaceholder.typicode.com/posts and it fetches correctly.
What could be the issue? Anything I am missing?
EDIT
I tried the following but got 'Network response was not ok. and logged the following in EDIT 2:
fetch('http://www.localhost:8080/ota/upload/config/', myInit).then(function(response) {
if(response.ok) {
response.blob().then(function(myBlob) {
var objectURL = URL.createObjectURL(myBlob);
console.log(objectURL)
});
} else {
console.log('Network response was not ok.');
}
})
.catch(function(error) {
console.log('There has been a problem with your fetch operation: ' + error.message);
});
EDIT 2 - ADDITIONAL INFO



headersnotheader