正如标题所述,我正在尝试将文件附加到现有任务,我正在使用Nodejs和request()来执行此操作,但响应显示为:400 Bad Request。
我将向您展示代码,以供您查看我是否做错了事。
let contents = imagen.image, //this is an array buffer with the image
imageData64 = imagen.imageData64, //this is a base64 code with the mimetype
returnedB64 = imagen.returnedB64,// this is just the base64 code
blob = Buffer.from(returnedB64, ‘base64’),
formData = new FormData();
formData.append("file", contents);
const options = {
method: "POST",
url: asanaUrl,
headers: {
"Content-Disposition": "form-data",
"Content-Type": "multipart/form-data",
"boundary": "1z2x3c4v5b",
"Authorization": "Basic my token",
},
formData: {
"image": formData,
"file": contents
}
};
IMPORTS.request(options, function (err, res, body) {
if (err) console.log(err);
console.log(res.statusCode);
console.log(res.statusMessage);
});
我在做什么错了?
如果您能帮助我解决此问题,我将非常感谢。