File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -1713,12 +1713,10 @@ const server = http.createServer((req, res) => {
17131713});
17141714```
17151715
1716- ` Content-Length ` is given in bytes not characters. The above example
1717- works because the string ` 'hello world' ` contains only single byte characters.
1718- If the body contains higher coded characters then ` Buffer.byteLength() `
1719- should be used to determine the number of bytes in a given encoding.
1720- And Node.js does not check whether ` Content-Length ` and the length of the body
1721- which has been transmitted are equal or not.
1716+ ` Content-Length ` is given in bytes, not characters. Use
1717+ [ ` Buffer.byteLength() ` ] [ ] to determine the length of the body in bytes. Node.js
1718+ does not check whether ` Content-Length ` and the length of the body which has
1719+ been transmitted are equal or not.
17221720
17231721Attempting to set a header field name or value that contains invalid characters
17241722will result in a [ ` TypeError ` ] [ ] being thrown.
@@ -2388,6 +2386,7 @@ not abort the request or do anything besides add a `'timeout'` event.
23882386[ `'response'` ] : #http_event_response
23892387[ `'upgrade'` ] : #http_event_upgrade
23902388[ `Agent` ] : #http_class_http_agent
2389+ [ `Buffer.byteLength()` ] : buffer.html#buffer_class_method_buffer_bytelength_string_encoding
23912390[ `Duplex` ] : stream.html#stream_class_stream_duplex
23922391[ `TypeError` ] : errors.html#errors_class_typeerror
23932392[ `URL` ] : url.html#url_the_whatwg_url_api
You can’t perform that action at this time.
0 commit comments