0
如何上传一个字符串作为文件,并通过http post请求使用node.js
?上传一个字符串作为文件
这里是我的尝试:
var unirest = require('unirest');
unirest.post('127.0.0.1/upload')
.headers({'Content-Type': 'multipart/form-data'})
.attach('file', 'test.txt', 'some text in file') // Attachment
.end(function (response) {
console.log(response.body);
});
但没有任何反应