TypeError: Failed to execute 'fetch' on 'Window': Invalid value

后端 未结 8 571
情歌与酒
情歌与酒 2020-12-24 14:24

I\'ve tried to use fetch to call from backend using react, without libs (such as Axios). So I created this function:

export function api(url, method, body, i         


        
8条回答
  •  礼貌的吻别
    2020-12-24 15:04

    For me, i had an invalid character in a key of the header object. I accidentally included the ":" and this throws the error described. Really difficult to visually see in the chrome console. Hope it helps someone.

    { 'Authorization:':'Bearer etc...' }
    

提交回复
热议问题