Reputation: 725
I am running my react native code on expo client. When I try to fetch from google.com, for instance, I get
"TypeError: Network request failed"
error.
I have internet on my device. This error message does not make sense in detail. How can I understand the real problem beneath.
static test(provider, token, success, error) {
console.log(1); // TODO: remove
fetch("https://wwww.google.com", {
method: "GET",
})
.then(response => {
console.log(2); // TODO: remove
if (response.ok) {
success(response);
} else {
error(response);
}
}).catch(e => {
console.log("RestService Error: " + e);
});
}
Update: Snack added.
https://snack.expo.io/@dijkstras/fetch-issue
Upvotes: 0
Views: 1669
Reputation: 3621
You added 4 'wwww' in url address. fixed snack: https://snack.expo.io/@djalik/fetch-issue
Upvotes: 1