From 717789ec9f690e9d5216ce1c27688eef822940cc Mon Sep 17 00:00:00 2001 From: Marsup Date: Sun, 11 Sep 2011 01:25:15 +0200 Subject: [PATCH] Avoid duplicate emit when using a timeout When using a timeout and getting an error on the request, 2 errors were emitted. --- main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main.js b/main.js index 0e95e19dd..2bd00993c 100644 --- a/main.js +++ b/main.js @@ -148,6 +148,7 @@ Request.prototype.request = function () { var clientErrorHandler = function (error) { if (setHost) delete self.headers.host + if (self.timeout && self.timeoutTimer) clearTimeout(self.timeoutTimer) self.emit('error', error) } if (self.onResponse) self.on('error', function (e) {self.onResponse(e)})