简体   繁体   中英

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()

nvm changed the # to %23, but thanks to everyone

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM