-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: copyedit http.OutgoingMessage documentation #42733
doc: copyedit http.OutgoingMessage documentation #42733
Conversation
Review requested:
|
460a5b0
to
2aa311e
Compare
If this method is called and the header is not sent, it will call | ||
`this._implicitHeader` to flush implicit header. | ||
If the message should not have a body (indicated by `this._hasBody`), | ||
the call is ignored and `chunk` will not be sent. It could be useful | ||
when handling a particular message which must not include a body. | ||
e.g. response to `HEAD` request, `204` and `304` response. | ||
Sends a chunk of the body. This method can be called multiple times. | ||
|
||
`chunk` can be a string or a buffer. When `chunk` is a string, the | ||
`encoding` parameter specifies how to encode `chunk` into a byte stream. | ||
`callback` will be called when the `chunk` is flushed. | ||
The `encoding` argument is only relevant when `chunk` is a string. Defaults to | ||
`'utf8'`. | ||
|
||
If the message is transferred in chucked encoding | ||
(indicated by `this.chunkedEncoding`), `chunk` will be flushed as | ||
one chunk among a stream of chunks. Otherwise, it will be flushed as the | ||
body of message. | ||
|
||
This method handles the raw body of the HTTP message and has nothing to do | ||
with higher-level multi-part body encodings that may be used. | ||
|
||
If it is the first call to this method of a message, it will send the | ||
buffered header first, then flush the `chunk` as described above. | ||
|
||
The second and successive calls to this method will assume the data | ||
will be streamed and send the new data separately. It means that the response | ||
is buffered up to the first chunk of the body. | ||
The `callback` argument is optional and will be called when this chunk of data | ||
is flushed. | ||
|
||
Returns `true` if the entire data was flushed successfully to the kernel | ||
buffer. Returns `false` if all or part of the data was queued in the user | ||
memory. Event `drain` will be emitted when the buffer is free again. | ||
memory. The `'drain'` event will be emitted when the buffer is free again. |
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 simplified this because a detailed and specific description exists for both ClientRequest#write()
and ServerResponse#write()
.
Fix nits/typos and simplify some sentences.
2aa311e
to
f2785c1
Compare
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.
lgtm, good job!
Landed in 0699150 |
Fix nits/typos and simplify some sentences. PR-URL: nodejs#42733 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Fix nits/typos and simplify some sentences. PR-URL: #42733 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Fix nits/typos and simplify some sentences. PR-URL: #42733 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Fix nits/typos and simplify some sentences. PR-URL: #42733 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Fix nits/typos and simplify some sentences. PR-URL: #42733 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Fix nits/typos and simplify some sentences. PR-URL: #42733 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Fix nits/typos and simplify some sentences. PR-URL: nodejs/node#42733 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Fix nits/typos and simplify some sentences.