test: added net.connect lookup type check#11873
Closed
lucamaraschi wants to merge 4 commits intonodejs:masterfrom
Closed
test: added net.connect lookup type check#11873lucamaraschi wants to merge 4 commits intonodejs:masterfrom
lucamaraschi wants to merge 4 commits intonodejs:masterfrom
Conversation
Check the options passed to the connect function of Socket to validate the type of the lookupmproperty. It must be strictly a function.
jasnell
approved these changes
Mar 15, 2017
|
|
||
| const expectedError = /^TypeError: "lookup" option should be a function$/; | ||
|
|
||
| ['foobar', 1, {}, []].forEach((input => { connectThrows(input); })) |
Member
There was a problem hiding this comment.
Also.. the { and ; } around connectThrows(input) can be dropped.
| ['foobar', 1, {}, []].forEach((input => { connectThrows(input); })) | ||
|
|
||
| function connectThrows(input) { | ||
| var opts = { |
cjihrig
approved these changes
Mar 16, 2017
| const expectedError = /^TypeError: "lookup" option should be a function$/; | ||
|
|
||
| ['foobar', 1, {}, []].forEach((input => { connectThrows(input); })) | ||
| ['foobar', 1, {}, []].forEach((input => connectThrows(input) )); |
Contributor
There was a problem hiding this comment.
Can the extra parens around the arrow function here and on line 22 be removed?
Contributor
joyeecheung
approved these changes
Mar 16, 2017
mcollina
requested changes
Mar 16, 2017
| const opts = { | ||
| host: 'localhost', | ||
| port: common.PORT, | ||
| lookup: input, |
Member
There was a problem hiding this comment.
you should remove the comma here. Is this passing make lint?
| const opts = { | ||
| host: 'localhost', | ||
| port: common.PORT, | ||
| lookup: input, |
mcollina
approved these changes
Mar 16, 2017
evanlucas
approved these changes
Mar 16, 2017
lpinca
reviewed
Mar 17, 2017
|
|
||
| const expectedError = /^TypeError: "lookup" option should be a function$/; | ||
|
|
||
| ['foobar', 1, {}, []].forEach((input) => connectThrows(input)); |
Member
There was a problem hiding this comment.
Nit: how about adding other primitives (boolean, undefined, symbol)?
lpinca
approved these changes
Mar 17, 2017
Member
Contributor
|
Landed in 1ff6796. Thanks. |
cjihrig
pushed a commit
that referenced
this pull request
Mar 20, 2017
Check the options passed to Socket.prototype.connect() to validate the type of the lookup property. PR-URL: #11873 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
jungx098
pushed a commit
to jungx098/node
that referenced
this pull request
Mar 21, 2017
Check the options passed to Socket.prototype.connect() to validate the type of the lookup property. PR-URL: nodejs#11873 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
|
This PR need backport to v7 |
Member
|
Landed cleanly on v6.x (it's a new file, not sure why it needed a backport to v7). |
gibfahn
pushed a commit
that referenced
this pull request
Jun 20, 2017
Check the options passed to Socket.prototype.connect() to validate the type of the lookup property. PR-URL: #11873 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
MylesBorins
pushed a commit
that referenced
this pull request
Jul 11, 2017
Check the options passed to Socket.prototype.connect() to validate the type of the lookup property. PR-URL: #11873 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Check the options passed to the Socket connect function to validate
the type of the lookup property. It must be strictly a function.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test net