Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to distinguish connect timeouts and read timeouts #1660

Closed
kevinburkeshyp opened this issue Jun 26, 2015 · 2 comments
Closed

Ability to distinguish connect timeouts and read timeouts #1660

kevinburkeshyp opened this issue Jun 26, 2015 · 2 comments

Comments

@kevinburkeshyp
Copy link

This request times out because the connect socket call fails:

var request = require('request');
request.get('http://google.com:81', {timeout: 3000}, function(err, response, body) {
    console.log(err.code === 'ETIMEDOUT');
    process.exit(0);
});

This request times out because the read socket call doesn't see any response in 3 seconds:

var request = require('request');
request.get('http://localhost:5501', {timeout: 3000}, function(err, response, body) {
    console.log(err.code === 'ETIMEDOUT');
    process.exit(1);
})

(I'm using hamms in the second test)

It would be nice to be able to distinguish these. Particularly, requests to a third party provider are failing and it would be good to distinguish whether the request actually made it to their server (their problem) or not (our problem).

It would also be neat because you could figure out whether or not the request made it to the server - a connection timeout is always retry-able, a read timeout on a POST is not.

@matteocontrini
Copy link

Up

@simov
Copy link
Member

simov commented Aug 18, 2015

Fixed in #1711

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants