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

后端 未结 8 606
情歌与酒
情歌与酒 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:05

    This also happened to me when I tried to add an Authorization header to my fetch calls. In my case it was caused by a newline character in the header string, i.e. Bearer:\nsomelong-token. Changing the new line to a space solved the problem.

提交回复
热议问题