request: silence errors after cleanup.

This commit is contained in:
Christopher Jeffrey 2016-12-23 11:27:18 -08:00
parent 6ea846ee9a
commit e36adec092
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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
*/