Skip to content

Commit

Permalink
Merge pull request #2420 from duereg/master
Browse files Browse the repository at this point in the history
change .on to .once, remove possible memory leaks
  • Loading branch information
mikeal committed Oct 17, 2016
2 parents bb8e899 + bf8b0f7 commit cb8c1f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions request.js
Expand Up @@ -893,7 +893,7 @@ Request.prototype.onRequestResponse = function (response) {
}
})

response.on('end', function () {
response.once('end', function () {
self._ended = true
})

Expand Down Expand Up @@ -965,7 +965,7 @@ Request.prototype.onRequestResponse = function (response) {
self._destdata = true
self.emit('data', chunk)
})
responseContent.on('end', function (chunk) {
responseContent.once('end', function (chunk) {
self.emit('end', chunk)
})
responseContent.on('error', function (error) {
Expand Down

0 comments on commit cb8c1f6

Please sign in to comment.