doc: rectify http.ClientResponse close/end events
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 12 Oct 2012 13:27:47 +0000 (15:27 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Sat, 13 Oct 2012 13:17:51 +0000 (15:17 +0200)
* 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.

doc/api/http.markdown

index 666f3d7..e8bf483 100644 (file)
@@ -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