-
-
Notifications
You must be signed in to change notification settings - Fork 734
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
Fix request timeout no working #802
Conversation
Updated a failed test case which covers Restify use case #79. In that test case the See #79 (comment) |
Thanks for working on this @aleung. Could you add a test case asserting the new behavior? |
@ianwsperber The test case was there (test_timeout.js). It started failing with |
@ianwsperber Can we go forward? I just rebase my fix to master latest. |
@@ -3,3 +3,4 @@ npm-debug.log | |||
coverage | |||
.nyc_output/ | |||
tests/browserify-public/browserify-bundle.js | |||
.vscode/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~/.gitignore is a place for that
lib/request_overrider.js
Outdated
@@ -194,8 +195,6 @@ function RequestOverrider(req, options, interceptors, remove, cb) { | |||
// emit a fake socket. | |||
if (event == 'socket') { | |||
listener(req.socket); | |||
req.socket.emit('connect', req.socket); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your help and patience on this one @aleung. Your changes will go out in v9.0.8 today. |
I think this broke something. nock('http://myservice.it')
.get('/')
.query(true)
.socketDelay(2000)
.reply(400); request({ url: 'http://myservice.it/?something', timeout: 1000 }, (err) => {
// err is falsy
}); |
I hit the same issue. |
Thanks @matteocontrini & @lpinca, I've created #839 to track the bug. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you! |
This PR fixed #754 and #739
There are two changes:
socket.connecting
totrue
to allowrequest
module creates timeout timer.ClientRequest.connect
event after connection delay, just before sending response. Before modification, it emits too early and makerequest
module clears the connection timeout timer.