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(node/http): don't throw on .address() before .listen() #24432

Merged
merged 2 commits into from
Jul 4, 2024

Conversation

marvinhagemeister
Copy link
Contributor

@marvinhagemeister marvinhagemeister commented Jul 4, 2024

It's perfectly valid to access server.address() before calling .listen(). Until a server actively listens on a socket Node will return null here, but we threw a "Cannot access property 'port' of undefined" instead.

This was discovered when inspecting failures in Koa's test suite with Deno.

Copy link
Member

@satyarohith satyarohith left a comment

Choose a reason for hiding this comment

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

LGTM

@marvinhagemeister marvinhagemeister merged commit 96b527b into main Jul 4, 2024
17 checks passed
@marvinhagemeister marvinhagemeister deleted the http-address branch July 4, 2024 16:28
zebreus pushed a commit to zebreus/deno that referenced this pull request Jul 8, 2024
…24432)

It's perfectly valid to access `server.address()` before calling
`.listen()`. Until a server actively listens on a socket Node will
return `null` here, but we threw a "Cannot access property 'port' of
undefined" instead.

This was discovered when inspecting failures in Koa's test suite with
Deno.
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.

2 participants