代码之家  ›  专栏  ›  技术社区  ›  Ali

React native fetch不解析或拒绝API请求

  •  2
  • Ali  · 技术社区  · 7 年前

    在我的浏览器控制台中,我总是从这个请求得到正确的响应:

    fetch('http://178.62.66.29:8080/api/v1/auth/1/2', {
        method: "GET",
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
    })
        .then(response => response.json())
        .then(responsejson =>  console.log(responsejson))
        .catch(err => console.error(err));
    

    0 回复  |  直到 7 年前