[英]Axios Request failed with status code 404 - React Native
I am trying to send data to my Google Cloud server.我正在尝试将数据发送到我的 Google Cloud 服务器。 (login form). (登录表格)。 I have an error,我有一个错误,
[Error: Request failed with status code 404] [错误:请求失败,状态码为 404]
I also tried fetch method, but I got a network failed error there.我也尝试了 fetch 方法,但我在那里遇到了网络失败错误。
This is my code:这是我的代码:
handleLoginUser(){
const data = new FormData();
data.append('email', 'aaykgxr@gmail.com');
data.append('password', '1234567890');
return axios.post('http://*serverip*/users/login',
data,
{
headers: {
'Content-Type': 'application/json',
}
},
)
.then(function (response) {
console.log(response);
})
.catch(function (response) {
console.log(response);
});
}
Thanks for your help.谢谢你的帮助。
如果您使用 formdata,您应该使用其他一些内容类型:
'Content-type':'multipart/form-data'
'http:// serverip /users/login.json()....dot json() 丢失
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.