From bf8b0f73126e1d58af0ef4b848ade4d1d69c573f Mon Sep 17 00:00:00 2001 From: Matt Blair Date: Fri, 14 Oct 2016 10:42:26 -0700 Subject: [PATCH] change .on to .once, remove possible memory leaks --- request.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/request.js b/request.js index 96a71b6ed..edd824955 100644 --- a/request.js +++ b/request.js @@ -893,7 +893,7 @@ Request.prototype.onRequestResponse = function (response) { } }) - response.on('end', function () { + response.once('end', function () { self._ended = true }) @@ -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) {