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