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
Variadic listen signature allows string port #4269
Variadic listen signature allows string port #4269
Conversation
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.
Looks good to me.
@@ -200,3 +200,26 @@ test('listen when firstArg is { path: string(pipe) } and with backlog and callba | |||
t.equal(address, '\\\\.\\pipe\\testPipe3') | |||
}) | |||
}) | |||
|
|||
test('listen accepts a port as string, and callback', t => { |
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.
is there a test that checks that random port still works fine?
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.
I've added this test
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
resolves: #4267
At the moment when using the variadic signature of
listen
and passing theport
as astring
, theport
is converted to0
even though the signature allowsstring
as type.With this PR it is possible to convert the
port
fromstring
tonumber
, and only in case thestring
cannot be parsed to a valid integer it converts it to0
.Checklist
npm run test
andnpm run benchmark
and the Code of conduct