Closed asomethings closed 3 years ago
It's not just a wrong port, this also happens for me if the url resolves to an ip, but it is unconnectable for example due to a firewall or just doesn't have anything that would respond to it. I tried to upgrade to http-wrapper@2.0 mentioned in #1637 but same thing. EDIT: Oh the latest got already has it updated to 2.0, no wonder it didn't change anything.
got("https://123.123.123.123", {
timeout: 1000,
http2: true,
})
.then(() => console.log("success"))
.catch(() => console.log("fail"));
Takes like 2 minutes to resolve on my machine. But if I set http2 to false, it times out quickly. Even if I use cancel() on the request, the catch will get called with error, BUT the connection(?) still stays open and it keeps the node process open for the full duration until it times out after a minute or two.
Describe the bug
Request to a url which starts with https, url with port ends up with pending forever. Since timeout error is thrown well with
https, wrong url, http2 enabled
, I think it should throw timeout error instead of pending forever withhttps, wrong url, port, http2 enabled
too. Also i acknowledge that using https with port is an rare use case but still i think it should behave the same as others.Actual behavior
Promise pends forever.
Expected behavior
Below error should be thrown after 500ms
Code to reproduce
Checklist