小编omk*_*dav的帖子

在reactjs中使用axios发出请求时的400(错误请求)状态码

错误当尝试在 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)

铬合金[错误代码[![邮递员]3

api django django-rest-framework reactjs

0
推荐指数
1
解决办法
1492
查看次数

标签 统计

api ×1

django ×1

django-rest-framework ×1

reactjs ×1