-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
doc: Fix the ServerResponse
methods explainations to make it clear and not puzzled
#22305
Conversation
/cc:@mcollina :) |
@nodejs/documentation |
doc/api/http.md
Outdated
The request implements the [Writable Stream][] interface. This is an | ||
[`EventEmitter`][] with the following events: | ||
The request inherits from [Stream][], with some methods like what we have in | ||
[Writable Stream][]. There's an [`EventEmitter`][] with the following events: |
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 would change There's an EventEmitter with the following events
to It will emit the following events:
The There's an EventEmitter
part looks like it is something different from the response.
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.
OK, fixed. Thanks!
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.
LGTM
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.
Doc format LGTM.
Node.js Collaborators, please, add 👍 here if you approve fast-tracking. |
Please could whoever lands this correct the spelling of |
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'm confused by this. Does it implement all the methods of Writeable Stream? If so, then "with all methods of Writable Stream". But if that's the case, then "implements the interface" seems correct to me in the first place.
If it's not all the methods, can we say which methods it implements and which it does not?
The answer is:No. So you are also feeling confused by such sayings now :) But don't worry. Let's compare the methods together in both 【Stream.Writable】 【ServerResponse】 ONLY the two in bold below are the same (similar but NOT FROM |
@Trott:Add two diff methods as more clear. Thanks |
doc/api/http2.md
Outdated
The response inherits from [Stream][], with some methods like what we have in | ||
[Writable Stream][]. It will emit the following events: | ||
The response inherits from [Stream][], with two methods like what we have in | ||
[Writable Stream][]: [`response.write()`][] and [`response.end()`][]. |
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 It will emit the following events:
omission intentional?
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 don't think we usually preface documented events with a sentence like that so I'm for removing it.
doc/api/http.md
Outdated
@@ -313,8 +313,10 @@ the data is read it will consume memory that can eventually lead to a | |||
Node.js does not check whether Content-Length and the length of the | |||
body which has been transmitted are equal or not. | |||
|
|||
The request implements the [Writable Stream][] interface. This is an | |||
[`EventEmitter`][] with the following events: | |||
The request inherits from [Stream][], with two methods like what we have in |
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.
Can we just omit the two methods and the mention of Writable Stream
? The methods are documented below and mentioning Writable Stream
here seems to confuse more than enlighten.
The request inherits from [Stream][].
That's all that needs to be said. (Or is there a good reason to mention the other stuff?)
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.
Consider we still have events' introductions below it, so what about saying this as a transitional one?
The` request inherits from [Stream][], with some events, properties and methods below:
doc/api/http.md
Outdated
The request inherits from [Stream][], with two methods like what we have in | ||
[Writable Stream][]: [`request.write()`][] and [`request.end()`][]. | ||
|
||
And it will emit the following events: |
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.
This line is unnecessary and can be removed.
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.
OK. I'll remove.
@Trott: However it would be nicer if we add some transitional statement to link the explainations with the events, I don't want to see that events' introduction suddenly occur without a brief transitional introduction. Something like this:
If you insist your ideas and please still tell me, I'll do what you want :) |
How about this?: The request inherits from [Stream][], and additionally implements the following:
#Event 'connect' |
@Trott:Fixed, thanks! |
Ref: #14146. In short: `ServerResponse` acutally inherits from `OutgoingMessage`, with a series of methods like those in `Stream.Writable`. So we cannot use `implements`(this has made poeple feel puzzled because there are still many methods we don't need or have), so `inherits from Stream` is enough, due to some core reasons and performance told by mcollina from the ref (See some latest discussions at Ref).
Thanks! It seems I've passed all. |
Landed in 16accff |
In short: `ServerResponse` acutally inherits from `OutgoingMessage`, with a series of methods like those in `Stream.Writable`. So we cannot use `implements`(this has made poeple feel puzzled because there are still many methods we don't need or have), so `inherits from Stream` is enough, due to some core reasons and performance told by mcollina from the ref (See some latest discussions at Ref). Ref: nodejs#14146. PR-URL: nodejs#22305 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
An interesting thing I've noticed quite long:we landed the submitted changes and closed it, instead of merging it. How to do that? Is there anything benifits/diff for doing that, compared with "merging"? |
@Maledong See https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md#technical-howto for our process. There's an optional step to get things merged rather than closed. Most of us skip that step. |
OK, Thanks for all of your patience! |
In short: `ServerResponse` acutally inherits from `OutgoingMessage`, with a series of methods like those in `Stream.Writable`. So we cannot use `implements`(this has made poeple feel puzzled because there are still many methods we don't need or have), so `inherits from Stream` is enough, due to some core reasons and performance told by mcollina from the ref (See some latest discussions at Ref). Ref: #14146. PR-URL: #22305 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
In short: `ServerResponse` acutally inherits from `OutgoingMessage`, with a series of methods like those in `Stream.Writable`. So we cannot use `implements`(this has made poeple feel puzzled because there are still many methods we don't need or have), so `inherits from Stream` is enough, due to some core reasons and performance told by mcollina from the ref (See some latest discussions at Ref). Ref: #14146. PR-URL: #22305 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Ref: #14146.
In short:
ServerResponse
acutally inherits fromOutgoingMessage
,with a series of methods like those in
Stream.Writable
. So we cannotuse
implements
(this has made poeple feel puzzled because there arestill many methods we don't need or have), so
inherits from Stream
is enough,due to some core reasons and performance told by mcollina from the ref
(See some latest discussions at Ref).
make -j4 test
(UNIX), orvcbuild test
(Windows) passes