'Getting invalid json response while using fetch
I'm fetching the Clash of Clans API, but when I try to api.json() it, there is an Fetch-error.
FetchError: invalid json response body at https://api.clashofclans.com/v1/players/#9JYPUVU2J reason: Unexpected end of JSON input.
code:
clashofclansApi = await fetch(`https://api.clashofclans.com/v1/players/#${encodeURIComponent(tag)}`, {
method: `GET`,
headers: ({
'Authorization': `Bearer ${API_TOKEN}`,
})
})
api = await clashofclansApi.json()
Solution 1:[1]
nvm changed the # to %23, but thanks to everyone
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
