Skip to content

Commit 7972298

Browse files
MaleDongtargos
MaleDong
authored andcommitted
doc: clarify ServerResponse explanations
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 <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent d3ceaa1 commit 7972298

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

doc/api/http.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ the data is read it will consume memory that can eventually lead to a
313313
Node.js does not check whether Content-Length and the length of the
314314
body which has been transmitted are equal or not.
315315

316-
The request implements the [Writable Stream][] interface. This is an
317-
[`EventEmitter`][] with the following events:
316+
The request inherits from [Stream][], and additionally implements the
317+
following:
318318

319319
### Event: 'abort'
320320
<!-- YAML
@@ -1007,8 +1007,8 @@ added: v0.1.17
10071007
This object is created internally by an HTTP server — not by the user. It is
10081008
passed as the second parameter to the [`'request'`][] event.
10091009

1010-
The response implements, but does not inherit from, the [Writable Stream][]
1011-
interface. This is an [`EventEmitter`][] with the following events:
1010+
The response inherits from [Stream][], and additionally implements the
1011+
following:
10121012

10131013
### Event: 'close'
10141014
<!-- YAML
@@ -2062,7 +2062,6 @@ not abort the request or do anything besides add a `'timeout'` event.
20622062
[`'upgrade'`]: #http_event_upgrade
20632063
[`Agent`]: #http_class_http_agent
20642064
[`Duplex`]: stream.html#stream_class_stream_duplex
2065-
[`EventEmitter`]: events.html#events_class_eventemitter
20662065
[`TypeError`]: errors.html#errors_class_typeerror
20672066
[`URL`]: url.html#url_the_whatwg_url_api
20682067
[`agent.createConnection()`]: #http_agent_createconnection_options_callback
@@ -2105,4 +2104,3 @@ not abort the request or do anything besides add a `'timeout'` event.
21052104
[`socket.unref()`]: net.html#net_socket_unref
21062105
[`url.parse()`]: url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
21072106
[Readable Stream]: stream.html#stream_class_stream_readable
2108-
[Writable Stream]: stream.html#stream_class_stream_writable

doc/api/http2.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -2711,8 +2711,8 @@ added: v8.4.0
27112711
This object is created internally by an HTTP server — not by the user. It is
27122712
passed as the second parameter to the [`'request'`][] event.
27132713

2714-
The response implements, but does not inherit from, the [Writable Stream][]
2715-
interface. This is an [`EventEmitter`][] with the following events:
2714+
The response inherits from [Stream][], and additionally implements the
2715+
following:
27162716

27172717
#### Event: 'close'
27182718
<!-- YAML
@@ -3231,13 +3231,11 @@ following additional properties:
32313231
[Readable Stream]: stream.html#stream_class_stream_readable
32323232
[RFC 7838]: https://tools.ietf.org/html/rfc7838
32333233
[Using `options.selectPadding()`]: #http2_using_options_selectpadding
3234-
[Writable Stream]: stream.html#stream_writable_streams
32353234
[`'checkContinue'`]: #http2_event_checkcontinue
32363235
[`'request'`]: #http2_event_request
32373236
[`'unknownProtocol'`]: #http2_event_unknownprotocol
32383237
[`ClientHttp2Stream`]: #http2_class_clienthttp2stream
32393238
[`Duplex`]: stream.html#stream_class_stream_duplex
3240-
[`EventEmitter`]: events.html#events_class_eventemitter
32413239
[`Http2ServerRequest`]: #http2_class_http2_http2serverrequest
32423240
[`Http2Session` and Sockets]: #http2_http2session_and_sockets
32433241
[`Http2Stream`]: #http2_class_http2stream

0 commit comments

Comments
 (0)