formData: { [name]: fs.createReadStream(filePath) }
. Everything seems to work fine, however it adds ----------------------------237294480337614270082104 Content-Disposition: form-data; name="name.html"; filename="name.html" Content-Type: text/html
to the top of every file, which shows when displaying the html file somewhere else, and makes video files unusable. Why is it adding this? Is this something with request?
Hi all,
It might be a silly question but I don't know how to debug RequestJs.
Of course I checked readme
on https://github.com/request/request#debugging
I am newbie so I don't understand none of them but I tried number 2.
But I don't know where to check logs.
What I'd like to do is to see http request (including header) when I use request.post(...)
.
Any help would be appreciated!
curl
, it worked, but not on requestJs
.myrequest = request({
method: 'GET',
uri: file_url,
headers: {
range: ("bytes=" + bytes + "-" + totalSize)
}
}).on("error", function(err) {
alert("error");
});
when Internet connection is down, I am not getting error alert; Can someone help me with this? Thnx
request.post()
to send a fileStream in `multipart/form-data', something like this:let s3FileStream = s3.getObject(s3ObjectLocation).createReadStream();
let sender = "bob";
let receiver = "steve";
let formData = { "To": sender,
"From": receiver,
"file": s3FileStream };
request.post({
url: theURL,
formData: formData,
auth: {
user: theUserName,
pass: thePassword
}
})
"file"
in formData
is a string, it sends just fine.s3FileStream
as shown above, I get an HTTP 400 BAD REQUEST
request.post(...)
work when setting a formData
value to return from an S3.getObject().createReadStream()
request
appears to require fields readable
, path
, and mode
for isReadStream
.s3.getObject(s3ObjectLocation).createReadStream()
has readable
, it has nothing for path
or mode
.it seems like a test for method .pipe()
would be sufficient.
Like in axios: https://github.com/axios/axios/blob/master/lib/utils.js#L149