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

#1836 fixes expected Node behaviour for http.get #1837

Closed
wants to merge 16 commits into from

Conversation

kennethaasan
Copy link

@kennethaasan kennethaasan commented Dec 18, 2019

Fixes #1836

@paulmelnikow
Copy link
Member

Hi! Thanks for opening this!

Could you add a test for the correct behavior?

@kennethaasan
Copy link
Author

@paulmelnikow,

Please check now

t.equal(reqSpy.called, false)
scope.done()
http.request = origHttpReq
t.end()
Copy link
Member

Choose a reason for hiding this comment

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

When I run this test without the change, I get a TypeError. Is that the expected behavior?

Could you clarify how this test exercises the bug from #1836?

Copy link
Author

Choose a reason for hiding this comment

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

I added http.request to the spy function and now the test is failing on assertion instead of TypeError.

The test makes sure http.request is not called when using http.get. That fixes #1836

res.on('end', () => {
t.equal(reqSpy.called, false)
scope.done()
http.request = origHttpReq
Copy link
Member

Choose a reason for hiding this comment

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

For safety, could you move this cleanup code into a t.on('end', () => {}) callback?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, done

dependabot bot and others added 14 commits January 10, 2020 15:36
* chore(package): update eslint-plugin-node to version 11.0.0

* chore(package): update lockfile package-lock.json

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
* chore(package): update nyc to version 15.0.0

* chore(package): update lockfile package-lock.json

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
* chore(package): update sinon to version 8.0.0

* chore(package): update lockfile package-lock.json

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
* chore(package): update dtslint to version 2.0.0

* chore(package): update lockfile package-lock.json

* Update to 2.0.2

* Update lockfile

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
Fix a regression in 11.7.1 due to Jest having different globals: jestjs/jest#2549. Check functions using typeof instead of instanceof.
@kennethaasan kennethaasan force-pushed the node-http branch 2 times, most recently from 60ea3d6 to 628b9d7 Compare January 10, 2020 23:43
@kennethaasan
Copy link
Author

Sorry, I fucked up git when trying to rebase. I made a new clean PR at #1853

Closing this

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

Successfully merging this pull request may close these issues.

Breaking expected Node behaviour for http.get
5 participants