node icon indicating copy to clipboard operation
node copied to clipboard

why is the first argument to an http.Server's upgrade event listener called response?

Open jfhr opened this issue 1 year ago • 3 comments

Affected URL(s)

https://nodejs.org/api/http.html#event-upgrade

Description of the problem

The first argument passed to listeners on the 'upgrade' event on an http.Server is called response in the docs, even though to my understanding it contains the client request (i.e. http.IncomingMessage).

jfhr avatar Feb 13 '24 22:02 jfhr

Would you like to send a PR to improve the documentation?

marco-ippolito avatar Feb 14 '24 08:02 marco-ippolito

Hey, I'll send a PR this evening.

jfhr avatar Feb 14 '24 08:02 jfhr

The documentation is correct. The linked 'upgrade' event is the one received on the client. The listener takes the server response.

lpinca avatar Feb 15 '24 11:02 lpinca

Looks like I mixed up the two different upgrade events. In that case, this issue is obsolete. Sorry for the confusion and thanks Ipinca for clearing this up.

jfhr avatar Feb 19 '24 11:02 jfhr