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.58k stars 1.33k forks source link

connect timeout setting #1590

Open wrfighting opened 4 years ago

wrfighting commented 4 years ago

when I request a non-existent ip address,it will throw connect xxx timeout. so I want to set connect timeout I find we can use { response: xxx, deadline: xxx }, but it will not work well for the connect xxx timeout. eg. { response: 1000, deadline: 60000 } app.get('/httpgetok', function (req, res, next) { setTimeout(() => { res.send('ok'); }, 30000) }); will throw timeout 1000 error,but I just want to use response 1000 to set connect timeout. not response timeout

bitsofinfo commented 3 years ago

experiencing the same.... you can set timeouts all day, but if server is not up it just hangs

aseduto commented 1 year ago

Got the same problem: hang forever on non existing address. Any work around or fixing?