Skip to content

Commit ed316ae

Browse files
committed
Docs: some encodings contains multibyte chars.
fixes #888
1 parent 74d94b0 commit ed316ae

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

doc/api/http.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ be called before `response.end()` is called.
259259
If you call `response.write()` or `response.end()` before calling this, the
260260
implicit/mutable headers will be calculated and call this function for you.
261261

262+
Note: that Content-Length is given in bytes not characters. The above example
263+
works because the string `'hello world'` contains only single byte characters.
264+
If the body contains higher coded characters then `Buffer.byteLength()`
265+
should be used to determine the number of bytes in a given encoding.
266+
262267
### response.statusCode
263268

264269
When using implicit headers (not calling `response.writeHead()` explicitly), this property

0 commit comments

Comments
 (0)