Skip to content

Commit 753fcaa

Browse files
MicTechbnoordhuis
authored andcommitted
doc: extend example of http.request by end event
Added .on('end', callback) event to http.request example, because for first sight it's not clear from http documentation, how to handle end of request. PR-URL: #447 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 8440cac commit 753fcaa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

doc/api/http.markdown

+3
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,9 @@ Example:
514514
res.on('data', function (chunk) {
515515
console.log('BODY: ' + chunk);
516516
});
517+
res.on('end', function() {
518+
console.log('No more data in response.')
519+
})
517520
});
518521

519522
req.on('error', function(e) {

0 commit comments

Comments
 (0)