我试图在客户端javascript上使用superagent来向我的nodejs后端发出一个多部分表单发布请求。
只有attach()和part()方法才能解决错误
我的代码如下:
superagent
.post('/api/audio')
.attach('file', '/music/music.mp3' )
.end(function(err, res){
console.log(res.text);
});
我是根据他们的文档http://visionmedia.github.io/superagent/#multipart-requests写的,但它给我一个错误:
Uncaught TypeError: superagent.post(...).attach is not a function
我哪里错了?