📌  相关文章
📜  使用节点 js 发送多部分表单数据 axios - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:08.384000             🧑  作者: Mango

代码示例2
const axios = require('axios');
const FormData = require('form-data');

const form = new FormData();
// Second argument  can take Buffer or Stream (lazily read during the request) too.
// Third argument is filename if you want to simulate a file upload. Otherwise omit.
form.append('field', 'a,b,c', 'blah.csv');
axios.post('http://example.org/endpoint', form, {
  headers: form.getHeaders(),
}).then(result => {
  // Handle result…
  console.log(result.data);
});