Skip to content

Commit 335c05e

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
http: remove variable redeclaration
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: #4612 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 468fb2f commit 335c05e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/_http_client.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ function ClientRequest(options, cb) {
121121
if (self.socketPath) {
122122
self._last = true;
123123
self.shouldKeepAlive = false;
124-
var conn = self.agent.createConnection({ path: self.socketPath });
125-
self.onSocket(conn);
124+
self.onSocket(self.agent.createConnection({ path: self.socketPath }));
126125
} else if (self.agent) {
127126
// If there is an agent we should default to Connection:keep-alive,
128127
// but only if the Agent will actually reuse the connection!
@@ -141,12 +140,11 @@ function ClientRequest(options, cb) {
141140
self._last = true;
142141
self.shouldKeepAlive = false;
143142
if (options.createConnection) {
144-
var conn = options.createConnection(options);
143+
self.onSocket(options.createConnection(options));
145144
} else {
146145
debug('CLIENT use net.createConnection', options);
147-
var conn = net.createConnection(options);
146+
self.onSocket(net.createConnection(options));
148147
}
149-
self.onSocket(conn);
150148
}
151149

152150
self._deferToConnect(null, null, function() {

0 commit comments

Comments
 (0)