doc: clearify that http does chunked encoding itself. #28379
Conversation
|
Right… The commit guidelines didn't say no punctuation. I guess anyone merging this can simply do a --amend. |
|
Welcome @micromaomao and thanks for the pull request! As it currently stands, I think this addition to the docs probably creates more confusion than it clarifies. From the text, it's not clear if |
| @@ -772,6 +772,8 @@ server — in that case it is suggested to use the | |||
| `['Transfer-Encoding', 'chunked']` header line when | |||
| creating the request. | |||
|
|
|||
| Note that this module automatically encode data into chunked encoding. | |||
Trott
Jun 22, 2019
Member
| Note that this module automatically encode data into chunked encoding. | |
| This module automatically encodes data in chunked encoding. |
(That's a grammar fix and a style fix, but the content is still problematic, I think.)
|
I see what you're saying. I also noticed another issue, the doc already says:
What does suggested to use mean? According to my very quick scan of the source code in That aside, I think maybe the sentence should be rephrased as something like: This method can be called multiple times. If no Please correct me if my understanding is incorrect. |
In general, I'd be inclined to simply replace any occurrences of it is suggested to use or it is recommended to use to the more succinct use. In this particular case, if the suggestion is unnecessary, I'd remove it entirely.
/ping @nodejs/documentation @nodejs/http Does that change seem correct to you? (There are a few minor style changes I'd make to that, but I'm mostly concerned about getting the content and meaning correct first.) |
|
I'm good with an edited version of the text in #28379 (comment). Would you mind adding it to the PR? |
|
@mcollina Updated. @Trott wanted some style change. Also, looking at it now, I can see how the change may make the part that says
a little bit confusing. Maybe we should make it clear that the |
| will automatically be encoded in HTTP Chunked transfer encoding, so that | ||
| server knows when data ends. The `Transfer-Encoding: chunked` header will be | ||
| added. Call `end()` when finish sending data so that node would send the | ||
| trailer. |
ronag
Mar 11, 2020
Member
If no
Content-Lengthis set, data will automatically be encoded in HTTP
Chunked transfer encoding, so that server knows when data ends. TheTransfer-Encoding: chunkedheader will be automatically added.
Would be simpler maybe?
ronag
Mar 11, 2020
Member
With a reference to https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback? Even though it is not a Writable the intention is to act as similar as possible. @mcollina, what do you think? Would such a reference be harmful?
|
@micromaomao, can you follow up with review comments ? and this needs a rebase. |
8ae28ff
to
2935f72
|
@nodejs/http This needs reviews. |
| server. In that case, it is suggested to use the | ||
| `['Transfer-Encoding', 'chunked']` header line when | ||
| creating the request. | ||
| This method can be called multiple times. If no `Content-Length` is set, data |
|
@micromaomao Can you address the last comment please? |
|
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
|
I think it's alright. Do you want me to amend the commit adding the "Sends a chunk of the body." sentence to the beginning? |
|
amended, squashed and rebase'd. Also it's been one year so someone probably needs to verify that this is still the behavior of the function. |
doc/api/http.md
Outdated
Show resolved
Hide resolved
doc/api/http.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
|
@aduh95 done |
|
@nodejs/http Can we land this? |
|
lgtm |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #28379 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
Landed in 67d4a3f |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #28379 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #28379 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>


I don't know if I'm putting it in the right place in the doc (or if there is a better way to present this information), but I think stating this is necessary, and I couldn't find any mention of the fact that chunked encoding is handled by node itself in the existing http doc.
Checklist