In Node.js, no matter the library I use, I always get the error:
“No initial boundary string (or you have a truncated message).”
Example:
let data = new FormData();
data.append(‘image’, fs.createReadStream(’/Users/macarthurval/Downloads/348474752_942942806816470_8266448106391457053_n.jpg’));
data.append(‘sizeFactor’, ‘2’);
data.append(‘imageStyle’, ‘default’);
data.append(‘noiseCancellationFactor’, ‘0’);
let config = {
method: ‘post’,
maxBodyLength: Infinity,
url: ‘https://ai-picture-upscaler.p.rapidapi.com/supersize-image’,
headers: {
‘x-rapidapi-host’: ‘ai-picture-upscaler.p.rapidapi.com’,
‘x-rapidapi-key’: ‘-----’,
…data.getHeaders()
},
data : data
};
axios.request(config)
加入讨论 - 在下面添加评论:
Facing same error. Is there any fix for it?
Actually, I don’t know NodeJS, if it works on RapidAPI, then it has to work by using any language. However, eventually, it depends on to the code of using it.