From 661b2557d930059296341b824533219ecfacce1b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 10 Jan 2016 14:17:36 -0800 Subject: [PATCH] http: remove variable redeclaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In lib/_http_client.js, the variable `conn` was declared with the `var` keyword three times in the same scope. This change eliminates the variable entirely. PR-URL: https://github.com/nodejs/node/pull/4612 Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- lib/_http_client.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index db1db7bcc3..a5cccbdef8 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -115,8 +115,7 @@ function ClientRequest(options, cb) { if (self.socketPath) { self._last = true; self.shouldKeepAlive = false; - var conn = self.agent.createConnection({ path: self.socketPath }); - self.onSocket(conn); + self.onSocket(self.agent.createConnection({ path: self.socketPath })); } else if (self.agent) { // If there is an agent we should default to Connection:keep-alive, // but only if the Agent will actually reuse the connection! @@ -135,12 +134,11 @@ function ClientRequest(options, cb) { self._last = true; self.shouldKeepAlive = false; if (options.createConnection) { - var conn = options.createConnection(options); + self.onSocket(options.createConnection(options)); } else { debug('CLIENT use net.createConnection', options); - var conn = net.createConnection(options); + self.onSocket(net.createConnection(options)); } - self.onSocket(conn); } self._deferToConnect(null, null, function() {