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

doc: copyedit http.OutgoingMessage documentation #42733

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Apr 14, 2022

Fix nits/typos and simplify some sentences.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. labels Apr 14, 2022
@lpinca lpinca force-pushed the copyedit/outgoing-message-documentation branch 2 times, most recently from 460a5b0 to 2aa311e Compare April 14, 2022 10:34
Comment on lines -2804 to +2807
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.
Copy link
Member Author

@lpinca lpinca Apr 14, 2022

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.
@lpinca lpinca force-pushed the copyedit/outgoing-message-documentation branch from 2aa311e to f2785c1 Compare April 14, 2022 10:44
Copy link
Contributor

@ShogunPanda ShogunPanda left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm, good job!

@lpinca lpinca added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 17, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 17, 2022
@nodejs-github-bot nodejs-github-bot merged commit 0699150 into nodejs:master Apr 17, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in 0699150

@lpinca lpinca deleted the copyedit/outgoing-message-documentation branch April 17, 2022 19:24
xtx1130 pushed a commit to xtx1130/node that referenced this pull request Apr 25, 2022
Fix nits/typos and simplify some sentences.

PR-URL: nodejs#42733
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
targos pushed a commit that referenced this pull request Apr 28, 2022
Fix nits/typos and simplify some sentences.

PR-URL: #42733
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@targos targos mentioned this pull request May 2, 2022
juanarbol pushed a commit that referenced this pull request May 31, 2022
Fix nits/typos and simplify some sentences.

PR-URL: #42733
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
danielleadams pushed a commit that referenced this pull request Jun 27, 2022
Fix nits/typos and simplify some sentences.

PR-URL: #42733
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
targos pushed a commit that referenced this pull request Jul 11, 2022
Fix nits/typos and simplify some sentences.

PR-URL: #42733
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
targos pushed a commit that referenced this pull request Jul 31, 2022
Fix nits/typos and simplify some sentences.

PR-URL: #42733
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
Fix nits/typos and simplify some sentences.

PR-URL: nodejs/node#42733
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants