I am trying to send a pdf file to my node server and when my node server get the request it will send the same file to another api server. I am not suppose to store the file in my nodejs server. Just take the file and pass it to api server. here is my implementation below,
export const uploadDocument = async ctx => {
try {
const { file, path, type, buffer } =ctx.request.file;
const file = path + name;
await documentUpload(file);
} catch (error) {
console.log(error);
}
};
const documentUpload = async file => {
try {
let formData = new FormData();
formData.append("document", file);
const response = await axios.post(
`${variables.recruitUrl}/upload_url`,
formData,
{
headers: {
"Content-Type": "multipart/form-data",
Authorization: `Bearer 5dd872b44a.d6d2e2950b3ae3a9f8081369cd82c953`,
},
};
);
console.log(response);
} catch (error) {
console.log(error);
}
};
the error I am getting from the api server is ‘the request was rejected because no multipart boundary was found’, If I remove the content type multipart to nothing api server return extra param found.