Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
Trott committed Jan 10, 2016
commit faa0f89d8e96c44850045b6cc6a6c5203139cd63
8 changes: 3 additions & 5 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,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!
Expand All @@ -141,12 +140,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() {
Expand Down