Skip to content

Commit 216570b

Browse files
seebeeskoichik
authored andcommitted
Lint
1 parent a2eadda commit 216570b

11 files changed

Lines changed: 37 additions & 38 deletions

doc/api/http.markdown

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -487,29 +487,29 @@ Example:
487487

488488
## http.Agent
489489

490-
In node 0.5.3+ there is a new implementation of the HTTP Agent which is used
490+
In node 0.5.3+ there is a new implementation of the HTTP Agent which is used
491491
for pooling sockets used in HTTP client requests.
492492

493-
Previously, a single agent instance help the pool for single host+port. The
493+
Previously, a single agent instance help the pool for single host+port. The
494494
current implementation now holds sockets for any number of hosts.
495495

496-
The current HTTP Agent also defaults client requests to using
497-
Connection:keep-alive. If no pending HTTP requests are waiting on a socket
498-
to become free the socket is closed. This means that node's pool has the
499-
benefit of keep-alive when under load but still does not require developers
496+
The current HTTP Agent also defaults client requests to using
497+
Connection:keep-alive. If no pending HTTP requests are waiting on a socket
498+
to become free the socket is closed. This means that node's pool has the
499+
benefit of keep-alive when under load but still does not require developers
500500
to manually close the HTTP clients using keep-alive.
501501

502-
Sockets are removed from the agent's pool when the socket emits either a
503-
"close" event or a special "agentRemove" event. This means that if you intend
504-
to keep one HTTP request open for a long time and don't want it to stay in the
502+
Sockets are removed from the agent's pool when the socket emits either a
503+
"close" event or a special "agentRemove" event. This means that if you intend
504+
to keep one HTTP request open for a long time and don't want it to stay in the
505505
pool you can do something along the lines of:
506506

507507
http.get(options, function(res) {
508508
// Do stuff
509509
}).on("socket", function (socket) {
510510
socket.emit("agentRemove");
511511
});
512-
512+
513513
Alternatively, you could just opt out of pooling entirely using `agent:false`:
514514

515515
http.get({host:'localhost', port:80, path:'/', agent:false}, function (res) {

doc/api/https.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The options argument has the following options
6969
- method: HTTP request method. Default `'GET'`.
7070

7171
The following options can also be specified.
72-
However, a global [Agent](http.html#http.Agent) cannot be used.
72+
However, a global [Agent](http.html#http.Agent) cannot be used.
7373

7474
- key: Private key to use for SSL. Default `null`.
7575
- cert: Public x509 certificate to use. Default `null`.

lib/http.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ function ClientRequest(options, cb) {
10151015
if (options.port && +options.port !== options.defaultPort) {
10161016
hostHeader += ':' + options.port;
10171017
}
1018-
this.setHeader("Host", hostHeader);
1018+
this.setHeader('Host', hostHeader);
10191019
}
10201020
}
10211021

@@ -1032,9 +1032,11 @@ function ClientRequest(options, cb) {
10321032
}
10331033

10341034
if (Array.isArray(options.headers)) {
1035-
self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n', options.headers);
1035+
self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n',
1036+
options.headers);
10361037
} else if (self.getHeader('expect')) {
1037-
self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n', self._renderHeaders());
1038+
self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n',
1039+
self._renderHeaders());
10381040
}
10391041
if (self.socketPath) {
10401042
self._last = true;
@@ -1060,9 +1062,9 @@ function ClientRequest(options, cb) {
10601062
}
10611063
}
10621064

1063-
self._deferToConnect(null, null, function () {
1065+
self._deferToConnect(null, null, function() {
10641066
self._flush();
1065-
})
1067+
});
10661068

10671069
}
10681070
util.inherits(ClientRequest, OutgoingMessage);
@@ -1095,7 +1097,7 @@ function createHangUpError() {
10951097

10961098
ClientRequest.prototype.onSocket = function(socket) {
10971099
var req = this;
1098-
process.nextTick(function () {
1100+
process.nextTick(function() {
10991101
var parser = parsers.alloc();
11001102
req.socket = socket;
11011103
req.connection = socket;

lib/url.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function urlParse(url, parseQueryString, slashesDenoteHost) {
234234
}
235235
out.hostname = newOut.join('.');
236236

237-
out.host = (out.hostname || '') +
237+
out.host = (out.hostname || '') +
238238
((out.port) ? ':' + out.port : '');
239239
out.href += out.host;
240240
}
@@ -419,7 +419,7 @@ function urlResolveObject(source, relative) {
419419
//to support http.request
420420
if (source.pathname !== undefined || source.search !== undefined) {
421421
source.path = (source.pathname ? source.pathname : '') +
422-
(source.search ? source.search : '');
422+
(source.search ? source.search : '');
423423
}
424424
source.slashes = source.slashes || relative.slashes;
425425
source.href = urlFormat(source);
@@ -504,7 +504,7 @@ function urlResolveObject(source, relative) {
504504
//to support http.request
505505
if (source.pathname !== undefined || source.search !== undefined) {
506506
source.path = (source.pathname ? source.pathname : '') +
507-
(source.search ? source.search : '');
507+
(source.search ? source.search : '');
508508
}
509509
source.href = urlFormat(source);
510510
return source;
@@ -590,7 +590,7 @@ function urlResolveObject(source, relative) {
590590
//to support request.http
591591
if (source.pathname !== undefined || source.search !== undefined) {
592592
source.path = (source.pathname ? source.pathname : '') +
593-
(source.search ? source.search : '');
593+
(source.search ? source.search : '');
594594
}
595595
source.auth = relative.auth || source.auth;
596596
source.slashes = source.slashes || relative.slashes;

test/simple/test-http-url.parse-auth-with-header-in-request.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
var common = require('../common');
2323
var assert = require('assert');
2424
var http = require('http');
25-
var https = require('https');
2625
var url = require('url');
2726

2827
var testURL = url.parse('http://asdf:qwer@localhost:' + common.PORT);
@@ -45,7 +44,7 @@ var server = http.createServer(function(request, response) {
4544
server.close();
4645
});
4746

48-
server.listen(common.PORT, function () {
47+
server.listen(common.PORT, function() {
4948
// make the request
5049
http.request(testURL).end();
5150
});

test/simple/test-http-url.parse-auth.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
var common = require('../common');
2323
var assert = require('assert');
2424
var http = require('http');
25-
var https = require('https');
2625
var url = require('url');
2726

2827
var testURL = url.parse('http://asdf:qwer@localhost:' + common.PORT);
@@ -40,7 +39,7 @@ var server = http.createServer(function(request, response) {
4039
server.close();
4140
});
4241

43-
server.listen(common.PORT, function () {
42+
server.listen(common.PORT, function() {
4443
// make the request
4544
http.request(testURL).end();
4645
});

test/simple/test-http-url.parse-https.request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var server = https.createServer(httpsOptions, function(request, response) {
4747
server.close();
4848
});
4949

50-
server.listen(common.PORT, function () {
50+
server.listen(common.PORT, function() {
5151
// make the request
5252
var clientRequest = https.request(testURL);
5353
// since there is a little magic with the agent

test/simple/test-http-url.parse-path.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
var common = require('../common');
2323
var assert = require('assert');
2424
var http = require('http');
25-
var https = require('https');
2625
var url = require('url');
2726

2827
var testURL = url.parse('http://localhost:' + common.PORT + '/asdf');
@@ -40,7 +39,7 @@ var server = http.createServer(function(request, response) {
4039
server.close();
4140
});
4241

43-
server.listen(common.PORT, function () {
42+
server.listen(common.PORT, function() {
4443
// make the request
4544
http.request(testURL).end();
4645
});

test/simple/test-http-url.parse-post.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ var testURL = url.parse('http://localhost:' + common.PORT + '/asdf?qwer=zxcv');
2929
testURL.method = 'POST';
3030

3131
function check(request) {
32-
//url.parse should not mess with the method
33-
assert.strictEqual(request.method, 'POST');
34-
//everything else should be right
35-
assert.strictEqual(request.url, '/asdf?qwer=zxcv');
36-
//the host header should use the url.parse.hostname
37-
assert.strictEqual(request.headers.host,
38-
testURL.hostname + ':' + testURL.port);
32+
//url.parse should not mess with the method
33+
assert.strictEqual(request.method, 'POST');
34+
//everything else should be right
35+
assert.strictEqual(request.url, '/asdf?qwer=zxcv');
36+
//the host header should use the url.parse.hostname
37+
assert.strictEqual(request.headers.host,
38+
testURL.hostname + ':' + testURL.port);
3939
}
4040

4141
var server = http.createServer(function(request, response) {
@@ -46,7 +46,7 @@ var server = http.createServer(function(request, response) {
4646
server.close();
4747
});
4848

49-
server.listen(common.PORT, function () {
49+
server.listen(common.PORT, function() {
5050
// make the request
5151
http.request(testURL).end();
5252
});

test/simple/test-http-url.parse-search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var server = http.createServer(function(request, response) {
4040
server.close();
4141
});
4242

43-
server.listen(common.PORT, function () {
43+
server.listen(common.PORT, function() {
4444
// make the request
4545
http.request(testURL).end();
4646
});

0 commit comments

Comments
 (0)