File tree 1 file changed +5
-6
lines changed
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) => {
1713
1713
});
1714
1714
```
1715
1715
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.
1722
1720
1723
1721
Attempting to set a header field name or value that contains invalid characters
1724
1722
will result in a [ ` TypeError ` ] [ ] being thrown.
@@ -2388,6 +2386,7 @@ not abort the request or do anything besides add a `'timeout'` event.
2388
2386
[ `'response'` ] : #http_event_response
2389
2387
[ `'upgrade'` ] : #http_event_upgrade
2390
2388
[ `Agent` ] : #http_class_http_agent
2389
+ [ `Buffer.byteLength()` ] : buffer.html#buffer_class_method_buffer_bytelength_string_encoding
2391
2390
[ `Duplex` ] : stream.html#stream_class_stream_duplex
2392
2391
[ `TypeError` ] : errors.html#errors_class_typeerror
2393
2392
[ `URL` ] : url.html#url_the_whatwg_url_api
You can’t perform that action at this time.
0 commit comments