我尝试使用Axios方法调用一个https请求get方法API,它从服务器响应200,但在服务器端,API没有命中。不知道响应来自哪里,和我尝试使用post-man的API一样,我得到了200状态,正确地更新了响应。之后,我开始使用react-native-debugger来调试响应,我使用网络检查器进行了调试,并且我尝试了相同的API,它得到了200的正确响应。这里面会有什么问题。谁来帮我找出这个bug。
我使用fetch添加了下面的代码,在Axios调用中也发生了同样的情况。当在react-native-debugger中启用网络检查器时,我还发现了一件事,API工作得很好。
fetch(requestUrl, {
method: methods.get,
headers: head,
})
.then(response => response.json())
.then(responseJson => {
console.log('res JSON', responseJson);
alert('your todolist is completed!!');
}
})
.catch(error => {
console.error(error);
});发布于 2019-12-26 18:34:46
React Native - Fetch call cached
在上面的链接中找到了这个问题的答案,它在Axios中存储了一个缓存或fetch本身。不是,它工作得很完美。谢谢你们所有人。
https://stackoverflow.com/questions/59469286
复制相似问题