Open Daniyal83 opened 5 years ago
Hello @Daniyal83 I had the same problem, my solution was update the form-data dependency of unirest-nodejs to the last version (2.5.1) on the package.js of unirest-nodejs
I am facing the same error. I use "unirest": "^0.6.0" and "form-data": "^3.0.0" Any idea?
Hi All , Any update on above mentioned issue? I am facing same problem
Hello @Daniyal83 I had the same problem, my solution was update the form-data dependency of unirest-nodejs to the last version (2.5.1) on the package.js of unirest-nodejs
How you updated, its internally used by unirest
Still getting this error with unirest 0.6.0 and form-data 4.0.0 while trying to upload attachments in Freshdesk. Most annoying part is I can't figure out how to catch it so it keeps stopping program execution -
try {
unirest.put(url)
.headers(headers)
.attach('attachments[]', fs.createReadStream('./FDattachments/' + encodeURIComponent(attachElement.name)))
.end(function(response){
//console.log(response.body)
console.log(response.headers)
console.log("Response Status : " + response.status)
if(response.status == 201){
console.log("Location Header : "+ response.headers['location'])
}
else{
console.log("X-Request-Id :" + response.headers['x-request-id']);
}
});
} catch (err) {
console.log(err)
}
Error thrown -
PS C:\Users\jaywi\Downloads\SW Dev\Heroku Node JS\CSQ> node migratemoretest.js > migrate_output.txt node:_http_outgoing:566 throw new ERR_HTTP_INVALID_HEADER_VALUE(value, name); ^
TypeError [ERR_HTTP_INVALID_HEADER_VALUE]: Invalid value "undefined" for header "Content-Length"
at ClientRequest.setHeader (node:_http_outgoing:579:3)
at FormData.
Hello. When I use unirest to make a request a get an error ' Invalid value "undefined" for header "Content-Length" '. How can I prevent that? It happens from time to time, but not every time. I'm using node.js on backend for my application. Here is my function