Ok it works with node-fetch
But it doesn’t work with fetch that is in NodeJS “core”. Not sure what the difference is though
So
using “core fetch”
let r = await fetch(
'https://api.twitch.tv/helix/videos?game_id=32399',
{
method: 'GET',
headers: {
'Client-ID': `${client_id}`,
'Authorization': `Bearer ${token}`,
'Accept': 'application/json'
}
}
);
let p = await r.json();
console.log(p);
Result:
But using node-fetch does work
import fetch from 'node-fetch';
let r = await fetch(
'https://api.twitch.tv/helix/videos?game_id=32399',
{
method: 'GET',
headers: {
'Client-ID': `${client_id}`,
'Authorization': `Bearer ${token}`,
'Accept': 'application/json'
}
}
);
let p = await r.json();
console.log(p);

