Managed to get a JSON response in Postman, but got an empty response in the console, with no errors whatsoever.
here's the code:
function getFetch() {
const url = `https://fantasy.premierleague.com/api/bootstrap-static/`;
let requestOptions = {
method: "GET",
redirect: "follow",
mode: 'no-cors',
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET",
"Access-Control-Allow-Headers": "x-requested-with"
};
fetch(
"https://fantasy.premierleague.com/api/bootstrap-static/",
requestOptions
)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
}
P.S: I also get the JSON if I typed the URL in the browser. But not with a fetch