Skip to content

Commit 6359e01

Browse files
geekisaacs
authored andcommitted
docs: Warning about consuming response
1 parent 6327d67 commit 6359e01

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

doc/api/http.markdown

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ Boolean (read-only). True if headers were sent, false otherwise.
315315

316316
### response.sendDate
317317

318-
When true, the Date header will be automatically generated and sent in
318+
When true, the Date header will be automatically generated and sent in
319319
the response if it is not already present in the headers. Defaults to true.
320320

321321
This should only be disabled for testing; HTTP requires the Date header
@@ -526,17 +526,17 @@ Alternatively, you could just opt out of pooling entirely using `agent:false`:
526526

527527
### agent.maxSockets
528528

529-
By default set to 5. Determines how many concurrent sockets the agent can have
529+
By default set to 5. Determines how many concurrent sockets the agent can have
530530
open per host.
531531

532532
### agent.sockets
533533

534-
An object which contains arrays of sockets currently in use by the Agent. Do not
534+
An object which contains arrays of sockets currently in use by the Agent. Do not
535535
modify.
536536

537537
### agent.requests
538538

539-
An object which contains queues of requests that have not yet been assigned to
539+
An object which contains queues of requests that have not yet been assigned to
540540
sockets. Do not modify.
541541

542542
## http.globalAgent
@@ -566,7 +566,9 @@ entirely discarded. However, if you add a `'response'` event handler,
566566
then you **must** consume the data from the response object, either by
567567
calling `response.read()` whenever there is a `'readable'` event, or
568568
by adding a `'data'` handler, or by calling the `.resume()` method.
569-
Until the data is consumed, the `'end'` event will not fire.
569+
Until the data is consumed, the `'end'` event will not fire. Also, until
570+
the data is read it will consume memory that can eventually lead to a
571+
'process out of memory' error.
570572

571573
Note: Node does not check whether Content-Length and the length of the body
572574
which has been transmitted are equal or not.

0 commit comments

Comments
 (0)