axios

作者: 别过经年 | 来源:发表于2019-03-20 18:23 被阅读0次

1. 以formdata的方式提交数据

  • 最常见的是
  const form = new FormData();
  form.append("name", name);
  form.append("password", encryptor.encrypt(password));

这个时候的请求头是Content-Type: multipart/form-data; 一般用于文件的上传

  • Content-Type: application/x-www-form-urlencoded 这种方式提交
const qs = require('qs');
axios.post('/foo', qs.stringify({ 'bar': 123 }));

axios 用application/x-www-form-urlencoded 传参格式不对
browser

相关文章

网友评论

      本文标题:axios

      本文链接:https://www.haomeiwen.com/subject/cdbtvqtx.html