I got the following error when trying to Fetch a 3rd party. I need a help ASAP.
Unhandled rejection FetchError: invalid json response body at Driving Directions, Traffic Reports & Carpool Rideshares by Waze reason: Unexpected token < in JSON at position 0
My backend code is:
const url= “Driving Directions, Traffic Reports & Carpool Rideshares by Waze”
return fetch(url, {
method: ‘get’,
// headers: {
//‘Content-Type’: ‘application/json’
// },
// body: JSON.s({
someVariable: (latitude, longitude)
// })
}).then( (httpResponse) => {
console.log(httpResponse.json())
if (httpResponse.ok) {
return httpResponse.json();
} else {
return Promise.reject(“Fetch did not succeed”);
}
} );