Skip to content

Commit

Permalink
doc: clearify when does http module does chunked transfer encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
micromaomao committed Apr 11, 2020
1 parent d278512 commit 1bb99bb
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -883,13 +883,11 @@ added: v0.1.29
* `callback` {Function}
* Returns: {boolean}

Sends a chunk of the body. By calling this method
many times, a request body can be sent to a
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.
This method can be called multiple times. If no `Content-Length` is set, data
will automatically be encoded in HTTP Chunked transfer encoding, so that
server knows when the data ends. The `Transfer-Encoding: chunked` header will
be added. Call `end()` when finish sending data so that node would send the
trailer.

The `encoding` argument is optional and only applies when `chunk` is a string.
Defaults to `'utf8'`.
Expand Down

0 comments on commit 1bb99bb

Please sign in to comment.