axios

2019-03-20  本文已影响0人  别过经年

1. 以formdata的方式提交数据

  const form = new FormData();
  form.append("name", name);
  form.append("password", encryptor.encrypt(password));

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

const qs = require('qs');
axios.post('/foo', qs.stringify({ 'bar': 123 }));

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

上一篇 下一篇

猜你喜欢

热点阅读