获取错误(评估'input.bodyUsed')

use*_*794 0 javascript react-native

在下面的代码中,我没有得到响应,而是得到一个未定义的错误.

未定义的错误

fetchData() {
  fetch(Global.user_list)
    .then((response) => {
      if (response.ok) {
        return response.json()
      } 
    })
    .then((data) => {})
    .catch((err)=> {
      alert(err)
    })
}
Run Code Online (Sandbox Code Playgroud)

小智 6

我偶然得到了同样的例外.我正在进行重构,但未能为fetch函数提供有效的url.

所以我建议你检查一下里面是什么Global.user_list.