I've been trying to get this API working on one of my react native project and I keep getting failed to fetch errors. This is the code
let url = "API endpoint";
let headers = {
Authorization:
"working bearer token"
};
fetch(url, {
method: "GET",
headers: headers,
body: null
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.log(error));
When I try this on a postman, it works just fine and returns correct data.
When the data is coming from API that is [] empty array, the fetch works again. But when there is a large data, I get a fetch error.
How can I solve this issue? Thank you
EDIT: To add, it is definitely not a CORS issue.