Skip to content

Commit 661b255

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 7afcdd3 commit 661b255

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
@@ -115,8 +115,7 @@ function ClientRequest(options, cb) {
115115
if (self.socketPath) {
116116
self._last = true;
117117
self.shouldKeepAlive = false;
118-
var conn = self.agent.createConnection({ path: self.socketPath });
119-
self.onSocket(conn);
118+
self.onSocket(self.agent.createConnection({ path: self.socketPath }));
120119
} else if (self.agent) {
121120
// If there is an agent we should default to Connection:keep-alive,
122121
// but only if the Agent will actually reuse the connection!
@@ -135,12 +134,11 @@ function ClientRequest(options, cb) {
135134
self._last = true;
136135
self.shouldKeepAlive = false;
137136
if (options.createConnection) {
138-
var conn = options.createConnection(options);
137+
self.onSocket(options.createConnection(options));
139138
} else {
140139
debug('CLIENT use net.createConnection', options);
141-
var conn = net.createConnection(options);
140+
self.onSocket(net.createConnection(options));
142141
}
143-
self.onSocket(conn);
144142
}
145143

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

0 commit comments

Comments
 (0)