Skip to content

Commit 1bb99bb

Browse files
committed
doc: clearify when does http module does chunked transfer encoding
1 parent d278512 commit 1bb99bb

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

doc/api/http.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -883,13 +883,11 @@ added: v0.1.29
883883
* `callback` {Function}
884884
* Returns: {boolean}
885885

886-
Sends a chunk of the body. By calling this method
887-
many times, a request body can be sent to a
888-
server. In that case, it is suggested to use the
889-
`['Transfer-Encoding', 'chunked']` header line when
890-
creating the request.
891-
892-
Note that this module automatically encode data into chunked encoding.
886+
This method can be called multiple times. If no `Content-Length` is set, data
887+
will automatically be encoded in HTTP Chunked transfer encoding, so that
888+
server knows when the data ends. The `Transfer-Encoding: chunked` header will
889+
be added. Call `end()` when finish sending data so that node would send the
890+
trailer.
893891

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

0 commit comments

Comments
 (0)