ladjs / superagent

Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
https://ladjs.github.io/superagent/
MIT License
16.57k stars 1.33k forks source link

pipe and timeout ? #991

Open gautaz opened 8 years ago

gautaz commented 8 years ago

Hello,

What is the current expected behavior regarding piping a response and setting a timeout? I have tested with some code close to this:

request.get(url).timeout(500).pipe(writestream)

But this does not seem to time out when the server side does not respond.

likino commented 6 years ago

req.on('error', function (err) { if (err) { // do something } })

gautaz commented 6 years ago

@likino This is in fact a working way to circumvent the issue. Nonetheless I would still expect timeout to operate in such a case, don't you agree?

chakradeb commented 6 years ago

Hey I am ready to fix this issue.

Would you consider If I submit PR?

kornelski commented 6 years ago

Yes, a fix is welcome.