Permalink
Browse files

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.
  • Loading branch information...
1 parent 99b2368 commit c8af471a7d79b09d206dfc635fbce93286d6a4c7 @bnoordhuis committed Oct 12, 2012
Showing with 12 additions and 5 deletions.
  1. +12 −5 doc/api/http.markdown
View
@@ -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

0 comments on commit c8af471

Please sign in to comment.