Skip to content

bug: alias connection to socket.#1590

Merged
gr2m merged 3 commits intonock:betafrom
mastermatt:req-connection
Jun 20, 2019
Merged

bug: alias connection to socket.#1590
gr2m merged 3 commits intonock:betafrom
mastermatt:req-connection

Conversation

@mastermatt
Copy link
Copy Markdown
Member

ClientRequest.connection is an alias for ClientRequest.socket.
https://nodejs.org/api/http.html#http_request_socket
https://github.com/nodejs/node/blob/master/lib/_http_client.js#L640-L641

IncomingMessage.connection is an alias for IncomingMessage.socket.
https://github.com/nodejs/node/blob/master/lib/_http_incoming.js#L44-L45

Adding req.connection and res.connection as a basic EventEmitter was to fix #74 when the request lib use to inspect the alias. This is not the case anymore.
res.connection was removed a few years later to improve coverage.

@mastermatt mastermatt added the bug label Jun 20, 2019
@mastermatt mastermatt requested review from gr2m and paulmelnikow June 20, 2019 03:50
@mastermatt
Copy link
Copy Markdown
Member Author

Coveralls is complaining because the whole lib lost two executable lines, however, this change actually brings request_overrider.js up to 100% coverage (#1404).

Copy link
Copy Markdown
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.

Thanks for picking this up!

Co-Authored-By: Paul Melnikow <github@paulmelnikow.com>
Copy link
Copy Markdown
Member

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks Matt!

@gr2m gr2m merged commit 659bf01 into nock:beta Jun 20, 2019
@mastermatt mastermatt deleted the req-connection branch June 20, 2019 19:38
@nockbot
Copy link
Copy Markdown
Collaborator

nockbot commented Jun 20, 2019

🎉 This PR is included in version 11.0.0-beta.20 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nockbot
Copy link
Copy Markdown
Collaborator

nockbot commented Aug 12, 2019

🎉 This PR is included in version 11.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

gr2m pushed a commit that referenced this pull request Sep 4, 2019
`ClientRequest.connection` is an alias for `ClientRequest.socket`.
https://nodejs.org/api/http.html#http_request_socket
https://github.com/nodejs/node/blob/master/lib/_http_client.js#L640-L641

`IncomingMessage.connection` is an alias for `IncomingMessage.socket`.
https://github.com/nodejs/node/blob/master/lib/_http_incoming.js#L44-L45

Co-Authored-By: Paul Melnikow <github@paulmelnikow.com>
gr2m pushed a commit that referenced this pull request Sep 4, 2019
`ClientRequest.connection` is an alias for `ClientRequest.socket`.
https://nodejs.org/api/http.html#http_request_socket
https://github.com/nodejs/node/blob/master/lib/_http_client.js#L640-L641

`IncomingMessage.connection` is an alias for `IncomingMessage.socket`.
https://github.com/nodejs/node/blob/master/lib/_http_incoming.js#L44-L45

Co-Authored-By: Paul Melnikow <github@paulmelnikow.com>
gr2m pushed a commit that referenced this pull request Sep 5, 2019
`ClientRequest.connection` is an alias for `ClientRequest.socket`.
https://nodejs.org/api/http.html#http_request_socket
https://github.com/nodejs/node/blob/master/lib/_http_client.js#L640-L641

`IncomingMessage.connection` is an alias for `IncomingMessage.socket`.
https://github.com/nodejs/node/blob/master/lib/_http_incoming.js#L44-L45

Co-Authored-By: Paul Melnikow <github@paulmelnikow.com>
juninmd pushed a commit to juninmd/nock that referenced this pull request Mar 21, 2026
`ClientRequest.connection` is an alias for `ClientRequest.socket`.
https://nodejs.org/api/http.html#http_request_socket
https://github.com/nodejs/node/blob/master/lib/_http_client.js#L640-L641

`IncomingMessage.connection` is an alias for `IncomingMessage.socket`.
https://github.com/nodejs/node/blob/master/lib/_http_incoming.js#L44-L45

Co-Authored-By: Paul Melnikow <github@paulmelnikow.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants