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

fix(socketDelay): support options.timeout #1848

Merged
merged 6 commits into from Feb 10, 2020
Merged

fix(socketDelay): support options.timeout #1848

merged 6 commits into from Feb 10, 2020

Conversation

gurpreetatwal
Copy link
Contributor

@gurpreetatwal gurpreetatwal commented Jan 2, 2020

The current implementation only supports req.setTimeout, but Node.js
allows for options.timeout to accomplish the same.

https://nodejs.org/docs/latest-v12.x/api/http.html#http_http_request_url_options_callback

Copy link
Member

@paulmelnikow paulmelnikow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks so much for this! 🙌

lib/intercepted_request_router.js Show resolved Hide resolved
@paulmelnikow
Copy link
Member

This looks good to me! I'll leave it open a couple more days in case anyone else wants to comment.

const onEnd = sinon.spy()

const req = http.request('http://example.test', { timeout: 5000 }, res => {
res.setEncoding('utf8')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this setEncoding have an affect on the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know to be fully honest. I copied the test case from above and made the minimal number of changes to make it work for options.timeout. I can take a look into it and adjust it for both tests cases if needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mastermatt any thoughts?

@mastermatt
Copy link
Member

This is failing on Node 8 because of the lock file issues we're having. Once that's fixed up and master is merged in again, this should be good to go.

@paulmelnikow paulmelnikow merged commit 061e922 into nock:master Feb 10, 2020
@nockbot
Copy link
Collaborator

nockbot commented Feb 10, 2020

🎉 This PR is included in version 11.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

4 participants