GeezerVison is showing github.com — test: prefer server over srv · nodejs/node@d76deca
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http-server-multiheaders.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,7 +28,7 @@ require('../common'); | 28 | 28 | const assert = require('assert'); | 29 | 29 | const http = require('http'); | 30 | 30 |
| 31 | | -const srv = http.createServer(function(req, res) { | | 31 | +const server = http.createServer(function(req, res) { | 32 | 32 | assert.strictEqual(req.headers.accept, 'abc, def, ghijklmnopqrst'); | 33 | 33 | assert.strictEqual(req.headers.host, 'foo'); | 34 | 34 | assert.strictEqual(req.headers['www-authenticate'], 'foo, bar, baz'); | @@ -43,10 +43,10 @@ const srv = http.createServer(function(req, res) { | 43 | 43 | res.writeHead(200, { 'Content-Type': 'text/plain' }); | 44 | 44 | res.end('EOF'); | 45 | 45 |
| 46 | | - srv.close(); | | 46 | + server.close(); | 47 | 47 | }); | 48 | 48 |
| 49 | | -srv.listen(0, function() { | | 49 | +server.listen(0, function() { | 50 | 50 | http.get({ | 51 | 51 | host: 'localhost', | 52 | 52 | port: this.address().port, | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http-server-multiheaders2.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -69,7 +69,7 @@ const multipleForbidden = [ | 69 | 69 | // 'Content-Length', | 70 | 70 | ]; | 71 | 71 |
| 72 | | -const srv = http.createServer(function(req, res) { | | 72 | +const server = http.createServer(function(req, res) { | 73 | 73 | multipleForbidden.forEach(function(header) { | 74 | 74 | assert.strictEqual(req.headers[header.toLowerCase()], 'foo', | 75 | 75 | `header parsed incorrectly: ${header}`); | @@ -83,7 +83,7 @@ const srv = http.createServer(function(req, res) { | 83 | 83 | res.writeHead(200, { 'Content-Type': 'text/plain' }); | 84 | 84 | res.end('EOF'); | 85 | 85 |
| 86 | | - srv.close(); | | 86 | + server.close(); | 87 | 87 | }); | 88 | 88 |
| 89 | 89 | function makeHeader(value) { | @@ -98,7 +98,7 @@ const headers = [] | 98 | 98 | .concat(multipleAllowed.map(makeHeader('bar'))) | 99 | 99 | .concat(multipleForbidden.map(makeHeader('bar'))); | 100 | 100 |
| 101 | | -srv.listen(0, function() { | | 101 | +server.listen(0, function() { | 102 | 102 | http.get({ | 103 | 103 | host: 'localhost', | 104 | 104 | port: this.address().port, | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http-upgrade-agent.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,7 +31,7 @@ const http = require('http'); | 31 | 31 | const net = require('net'); | 32 | 32 |
| 33 | 33 | // Create a TCP server | 34 | | -const srv = net.createServer(function(c) { | | 34 | +const server = net.createServer(function(c) { | 35 | 35 | c.on('data', function(d) { | 36 | 36 | c.write('HTTP/1.1 101\r\n'); | 37 | 37 | c.write('hello: world\r\n'); | @@ -46,7 +46,7 @@ const srv = net.createServer(function(c) { | 46 | 46 | }); | 47 | 47 | }); | 48 | 48 |
| 49 | | -srv.listen(0, '127.0.0.1', common.mustCall(function() { | | 49 | +server.listen(0, '127.0.0.1', common.mustCall(function() { | 50 | 50 |
| 51 | 51 | const options = { | 52 | 52 | port: this.address().port, | @@ -82,7 +82,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() { | 82 | 82 |
| 83 | 83 | req.on('close', common.mustCall(function() { | 84 | 84 | socket.end(); | 85 | | - srv.close(); | | 85 | + server.close(); | 86 | 86 | })); | 87 | 87 | })); | 88 | 88 | })); |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http-upgrade-client.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,7 @@ const Countdown = require('../common/countdown'); | 34 | 34 | const expectedRecvData = 'nurtzo'; | 35 | 35 |
| 36 | 36 | // Create a TCP server | 37 | | -const srv = net.createServer(function(c) { | | 37 | +const server = net.createServer(function(c) { | 38 | 38 | c.on('data', function(d) { | 39 | 39 | c.write('HTTP/1.1 101\r\n'); | 40 | 40 | c.write('hello: world\r\n'); | @@ -49,7 +49,7 @@ const srv = net.createServer(function(c) { | 49 | 49 | }); | 50 | 50 | }); | 51 | 51 |
| 52 | | -srv.listen(0, '127.0.0.1', common.mustCall(function() { | | 52 | +server.listen(0, '127.0.0.1', common.mustCall(function() { | 53 | 53 | const port = this.address().port; | 54 | 54 | const headers = [ | 55 | 55 | { | @@ -63,7 +63,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() { | 63 | 63 | ['Origin', 'http://www.websocket.org'] | 64 | 64 | ] | 65 | 65 | ]; | 66 | | - const countdown = new Countdown(headers.length, () => srv.close()); | | 66 | + const countdown = new Countdown(headers.length, () => server.close()); | 67 | 67 |
| 68 | 68 | headers.forEach(function(h) { | 69 | 69 | const req = http.get({ | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-net-error-twice.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,14 +37,14 @@ function ready() { | 37 | 37 | } | 38 | 38 | } | 39 | 39 |
| 40 | | -const srv = net.createServer(function onConnection(conn) { | | 40 | +const server = net.createServer(function onConnection(conn) { | 41 | 41 | conn.on('error', function(err) { | 42 | 42 | errs.push(err); | 43 | 43 | if (errs.length > 1 && errs[0] === errs[1]) | 44 | 44 | assert.fail('Should not emit the same error twice'); | 45 | 45 | }); | 46 | 46 | conn.on('close', function() { | 47 | | - srv.unref(); | | 47 | + server.unref(); | 48 | 48 | }); | 49 | 49 | serverSocket = conn; | 50 | 50 | ready(); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-net-server-listen-path.js +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,7 +55,7 @@ function randomPipePath() { | 55 | 55 | { | 56 | 56 | const handlePath = randomPipePath(); | 57 | 57 |
| 58 | | - const srv = net.createServer() | | 58 | + const server = net.createServer() | 59 | 59 | .listen({ | 60 | 60 | path: handlePath, | 61 | 61 | readableAll: true, | @@ -66,24 +66,24 @@ function randomPipePath() { | 66 | 66 | assert.notStrictEqual(mode & fs.constants.S_IROTH, 0); | 67 | 67 | assert.notStrictEqual(mode & fs.constants.S_IWOTH, 0); | 68 | 68 | } | 69 | | - srv.close(); | | 69 | + server.close(); | 70 | 70 | })); | 71 | 71 | } | 72 | 72 |
| 73 | 73 | // Test should emit "error" events when listening fails. | 74 | 74 | { | 75 | 75 | const handlePath = randomPipePath(); | 76 | | - const srv1 = net.createServer().listen({ path: handlePath }, () => { | | 76 | + const server1 = net.createServer().listen({ path: handlePath }, () => { | 77 | 77 | // As the handlePath is in use, binding to the same address again should | 78 | 78 | // make the server emit an 'EADDRINUSE' error. | 79 | | - const srv2 = net.createServer() | | 79 | + const server2 = net.createServer() | 80 | 80 | .listen({ | 81 | 81 | path: handlePath, | 82 | 82 | writableAll: true, | 83 | 83 | }, common.mustNotCall()); | 84 | 84 |
| 85 | | - srv2.on('error', common.mustCall((err) => { | 86 | | - srv1.close(); | | 85 | + server2.on('error', common.mustCall((err) => { | | 86 | + server1.close(); | 87 | 87 | assert.strictEqual(err.code, 'EADDRINUSE'); | 88 | 88 | assert(/^listen EADDRINUSE: address already in use/.test(err.message)); | 89 | 89 | })); | |
|