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

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

    I had this when passing a string with a newline character into the header object for example:

    const myString = 'this is a string \nand this is a new line';
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${token}`,
        'subscriptionId': myString
    }
    

提交回复
热议问题