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 @@ -1705,12 +1705,10 @@ const server = http.createServer((req, res) => {
1705
1705
});
1706
1706
```
1707
1707
1708
- ` Content-Length ` is given in bytes not characters. The above example
1709
- works because the string ` 'hello world' ` contains only single byte characters.
1710
- If the body contains higher coded characters then ` Buffer.byteLength() `
1711
- should be used to determine the number of bytes in a given encoding.
1712
- And Node.js does not check whether ` Content-Length ` and the length of the body
1713
- which has been transmitted are equal or not.
1708
+ ` Content-Length ` is given in bytes, not characters. Use
1709
+ [ ` Buffer.byteLength() ` ] [ ] to determine the length of the body in bytes. Node.js
1710
+ does not check whether ` Content-Length ` and the length of the body which has
1711
+ been transmitted are equal or not.
1714
1712
1715
1713
Attempting to set a header field name or value that contains invalid characters
1716
1714
will result in a [ ` TypeError ` ] [ ] being thrown.
@@ -2346,6 +2344,7 @@ not abort the request or do anything besides add a `'timeout'` event.
2346
2344
[ `'response'` ] : #http_event_response
2347
2345
[ `'upgrade'` ] : #http_event_upgrade
2348
2346
[ `Agent` ] : #http_class_http_agent
2347
+ [ `Buffer.byteLength()` ] : buffer.html#buffer_class_method_buffer_bytelength_string_encoding
2349
2348
[ `Duplex` ] : stream.html#stream_class_stream_duplex
2350
2349
[ `TypeError` ] : errors.html#errors_class_typeerror
2351
2350
[ `URL` ] : url.html#url_the_whatwg_url_api
You can’t perform that action at this time.
0 commit comments