From e36adec092f596516f5e8ecd7e7d9add401bb2d2 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 23 Dec 2016 11:27:18 -0800 Subject: [PATCH] request: silence errors after cleanup. --- lib/http/request.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/http/request.js b/lib/http/request.js index b1fb065d..c14c0f8e 100644 --- a/lib/http/request.js +++ b/lib/http/request.js @@ -308,12 +308,14 @@ Request.prototype.cleanup = function cleanup() { if (this.request) { this.request.removeListener('response', this.onResponse); this.request.removeListener('error', this.onEnd); + this.request.addListener('error', nop); } if (this.response) { this.response.removeListener('data', this.onData); this.response.removeListener('error', this.onEnd); this.response.removeListener('end', this.onEnd); + this.response.addListener('error', nop); } }; @@ -621,6 +623,8 @@ function ensureRequires(ssl) { StringDecoder = require('string_decoder').StringDecoder; } +function nop() {} + /* * Expose */