Skip to content

Commit f3af68e

Browse files
andrewhughes101codebytere
authored andcommitted
test: prefer server over srv
PR-URL: #31224 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 60e35d4 commit f3af68e

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

‎test/parallel/test-http-server-multiheaders.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require('../common');
2828
constassert=require('assert');
2929
consthttp=require('http');
3030

31-
constsrv=http.createServer(function(req,res){
31+
constserver=http.createServer(function(req,res){
3232
assert.strictEqual(req.headers.accept,'abc, def, ghijklmnopqrst');
3333
assert.strictEqual(req.headers.host,'foo');
3434
assert.strictEqual(req.headers['www-authenticate'],'foo, bar, baz');
@@ -43,10 +43,10 @@ const srv = http.createServer(function(req, res){
4343
res.writeHead(200,{'Content-Type': 'text/plain'});
4444
res.end('EOF');
4545

46-
srv.close();
46+
server.close();
4747
});
4848

49-
srv.listen(0,function(){
49+
server.listen(0,function(){
5050
http.get({
5151
host: 'localhost',
5252
port: this.address().port,

‎test/parallel/test-http-server-multiheaders2.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const multipleForbidden = [
6969
// 'Content-Length',
7070
];
7171

72-
constsrv=http.createServer(function(req,res){
72+
constserver=http.createServer(function(req,res){
7373
multipleForbidden.forEach(function(header){
7474
assert.strictEqual(req.headers[header.toLowerCase()],'foo',
7575
`header parsed incorrectly: ${header}`);
@@ -83,7 +83,7 @@ const srv = http.createServer(function(req, res){
8383
res.writeHead(200,{'Content-Type': 'text/plain'});
8484
res.end('EOF');
8585

86-
srv.close();
86+
server.close();
8787
});
8888

8989
functionmakeHeader(value){
@@ -98,7 +98,7 @@ const headers = []
9898
.concat(multipleAllowed.map(makeHeader('bar')))
9999
.concat(multipleForbidden.map(makeHeader('bar')));
100100

101-
srv.listen(0,function(){
101+
server.listen(0,function(){
102102
http.get({
103103
host: 'localhost',
104104
port: this.address().port,

‎test/parallel/test-http-upgrade-agent.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const http = require('http');
3131
constnet=require('net');
3232

3333
// Create a TCP server
34-
constsrv=net.createServer(function(c){
34+
constserver=net.createServer(function(c){
3535
c.on('data',function(d){
3636
c.write('HTTP/1.1 101\r\n');
3737
c.write('hello: world\r\n');
@@ -46,7 +46,7 @@ const srv = net.createServer(function(c){
4646
});
4747
});
4848

49-
srv.listen(0,'127.0.0.1',common.mustCall(function(){
49+
server.listen(0,'127.0.0.1',common.mustCall(function(){
5050

5151
constoptions={
5252
port: this.address().port,
@@ -82,7 +82,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function(){
8282

8383
req.on('close',common.mustCall(function(){
8484
socket.end();
85-
srv.close();
85+
server.close();
8686
}));
8787
}));
8888
}));

‎test/parallel/test-http-upgrade-client.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Countdown = require('../common/countdown');
3434
constexpectedRecvData='nurtzo';
3535

3636
// Create a TCP server
37-
constsrv=net.createServer(function(c){
37+
constserver=net.createServer(function(c){
3838
c.on('data',function(d){
3939
c.write('HTTP/1.1 101\r\n');
4040
c.write('hello: world\r\n');
@@ -49,7 +49,7 @@ const srv = net.createServer(function(c){
4949
});
5050
});
5151

52-
srv.listen(0,'127.0.0.1',common.mustCall(function(){
52+
server.listen(0,'127.0.0.1',common.mustCall(function(){
5353
constport=this.address().port;
5454
constheaders=[
5555
{
@@ -63,7 +63,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function(){
6363
['Origin','http://www.websocket.org']
6464
]
6565
];
66-
constcountdown=newCountdown(headers.length,()=>srv.close());
66+
constcountdown=newCountdown(headers.length,()=>server.close());
6767

6868
headers.forEach(function(h){
6969
constreq=http.get({

‎test/parallel/test-net-error-twice.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ function ready(){
3737
}
3838
}
3939

40-
constsrv=net.createServer(functiononConnection(conn){
40+
constserver=net.createServer(functiononConnection(conn){
4141
conn.on('error',function(err){
4242
errs.push(err);
4343
if(errs.length>1&&errs[0]===errs[1])
4444
assert.fail('Should not emit the same error twice');
4545
});
4646
conn.on('close',function(){
47-
srv.unref();
47+
server.unref();
4848
});
4949
serverSocket=conn;
5050
ready();

‎test/parallel/test-net-server-listen-path.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function randomPipePath(){
5555
{
5656
consthandlePath=randomPipePath();
5757

58-
constsrv=net.createServer()
58+
constserver=net.createServer()
5959
.listen({
6060
path: handlePath,
6161
readableAll: true,
@@ -66,24 +66,24 @@ function randomPipePath(){
6666
assert.notStrictEqual(mode&fs.constants.S_IROTH,0);
6767
assert.notStrictEqual(mode&fs.constants.S_IWOTH,0);
6868
}
69-
srv.close();
69+
server.close();
7070
}));
7171
}
7272

7373
// Test should emit "error" events when listening fails.
7474
{
7575
consthandlePath=randomPipePath();
76-
constsrv1=net.createServer().listen({path: handlePath},()=>{
76+
constserver1=net.createServer().listen({path: handlePath},()=>{
7777
// As the handlePath is in use, binding to the same address again should
7878
// make the server emit an 'EADDRINUSE' error.
79-
constsrv2=net.createServer()
79+
constserver2=net.createServer()
8080
.listen({
8181
path: handlePath,
8282
writableAll: true,
8383
},common.mustNotCall());
8484

85-
srv2.on('error',common.mustCall((err)=>{
86-
srv1.close();
85+
server2.on('error',common.mustCall((err)=>{
86+
server1.close();
8787
assert.strictEqual(err.code,'EADDRINUSE');
8888
assert(/^listenEADDRINUSE:addressalreadyinuse/.test(err.message));
8989
}));

0 commit comments

Comments
(0)