You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browser fetch (and by extension nodeJS inbuild fetch: aka Fetch that follows the spec), adds a accept-langauge header.
If that header is set to the value of * or anything valid, such as en-US for example, you get no results
But if you set the header to jibberish, then you get results
let url = 'https://api.twitch.tv/helix/videos?game_id=32399';
let r = await fetch(
url,
{
method: 'GET',
headers: {
'Client-ID': `${client_id}`,
'Authorization': `Bearer ${token}`,
'Accept': 'application/json',
'accept-language': 'YOUWHAT'
}
}
);
let p = await r.json();
console.log(p);
Dkamps18
changed the title
Games endpoint empty data array when specifying a game_id
Video's endpoint empty data array when specifying a game_id
Jul 19, 2023
Dkamps18
changed the title
Video's endpoint empty data array when specifying a game_id
Videos endpoint empty data array when specifying a game_id
Jul 19, 2023
Brief description
Videos endpoint returns an empty data array when specifying a game_id and querying from a browser.
How to reproduce
Call the videos api with a game_id from any browser.
Expected behavior
Match the behavior of the endpoint when being called from outside a browser
Screenshots
Not a screenshot but you can use this page as an example
Additional context or questions
Only broken when querying from a browser
The text was updated successfully, but these errors were encountered: