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. 请求头中必须包含一下内容

 

posted @ 2022-01-04 10:19  李悠然  阅读(1034)  评论(0编辑  收藏  举报