react native TypeError: Network request failed Unable to symbolicate stack trace: The stack is null


TypeError: Network request failed

Unable to symbolicate stack trace: The stack is null

通过分析可以看出是网络请求问题。在react native 中,尝试fetch发送请求导致的问题。

关于fetch的代码:

fetch('http://localhost:8083/user/getAllUser', {
method: 'POST',
headers: {
"Accept": "application/json",
"Content-Type": 'application/json',
"Connection": "close",
"type": "getUserData",
},
mode : "cors",
body : JSON.stringify({
page : 1,
type :0
})
}) .then((response) => response.json())
.then((responseJson) => {
console.log(responseJson);
return responseJson.movies;
})
.catch((error) => {
console.error(error);
});

在测试过程中提示错误。
1. Android 端接收的http请求必须是ip 即访问地址必须是IP地址

 

 2. 请求头中必须包含一下内容

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM