当尝试在 reactjs 中使用 axios 时,它在向邮递员发出请求时工作,它显示 400 状态代码
我已经尝试过 - 添加删除标题 - 添加边界:--foo
handleSubmit(event) {
let data = new FormData();
data.append("username", this.state.username)
data.append("password", this.state.password)
data.append("confirm_password", this.state.confirm_password)
data.append("email", this.state.email)
event.preventDefault();
axios({
method: 'post',
url: 'http://localhost:8000/api/account/register/',
data: data,
headers:{
"Content-Type":"application/x-www-form-urlencoded; boundary:XXboundaryXX"
}
})
.then((response) => {
console.log('bitchhh');
})
.catch((response) => {
//handle error
console.log(response);
});
}
Run Code Online (Sandbox Code Playgroud)