2
ReactNative爲我提供了發送httpRequest的方法。body的屬性包括我要發送到服務器的參數。但是我無法獲取參數我server.My碼在這裏:取回ReactNative無法將主體中的副本傳遞到服務器
fetch(`${keys.api}/login`,
{
method: 'POST',
body: JSON.stringify({
username: this.state.username,
password: this.state.password,
}),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
}
).then((response) => {
if(response._bodyText == 'success') {
this.props.resetToRoute({
name: '主頁',
component: Main,
hideNavigationBar: true,
});
} else {
this.cancelLogin();
}
}).catch((error) => {
console.warn(error);
this.cancelLogin();
});
在我的J2EE Web服務器控制檯打印消息: The httpRequest message
有一個在我的HttpRequest(換句話說,身體無法提供任何參數任何參數),我需要幫助。 在URL中顯示我的用戶名和密碼是危險的。
請inclu de相關的代碼部分從外部鏈接到代碼體中。 –