diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-10-12 17:27:47 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-10-13 17:17:51 +0400 |
commit | 4a23add90f155e6761d443d1277a31c2a2a4abb2 (patch) | |
tree | 218987bcbdec5d4308d2dec28d549d8c2d420db7 /doc | |
parent | b1e78cef097c682ed63528ad7efe294b18a9fb1d (diff) |
doc: rectify http.ClientResponse close/end events
* The 'close' event doesn't emit an error object.
* It's possible for a 'close' event to come after an 'end' event, contrary to
what the documentation said.
Fixes #4116.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/http.markdown | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/doc/api/http.markdown b/doc/api/http.markdown index 666f3d7f966..e8bf483f046 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -866,16 +866,23 @@ Note that the __data will be lost__ if there is no listener when a `function () { }` -Emitted exactly once for each message. No arguments. After -emitted no other events will be emitted on the response. +Emitted exactly once for each response. After that, no more `'data'` events +will be emitted on the response. + ### Event: 'close' -`function (err) { }` +`function () { }` Indicates that the underlaying connection was terminated before -`end` event was emitted. -See [http.ServerRequest][]'s `'close'` event for more information. +`response.end()` was called or able to flush. + +Just like `'end'`, this event occurs only once per response, and no more +`'data'` events will fire afterwards. See [http.ServerResponse][]'s `'close'` +event for more information. + +Note: `'close'` can fire after `'end'`, but not vice versa. + ### response.statusCode |