test: changed function to arrow function
PR-URL: https://github.com/nodejs/node/pull/25441 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
parent
1838d00eba
commit
27871c35b6
@ -27,7 +27,7 @@ const url = require('url');
|
|||||||
|
|
||||||
const expectedRequests = ['/hello', '/there', '/world'];
|
const expectedRequests = ['/hello', '/there', '/world'];
|
||||||
|
|
||||||
const server = http.Server(common.mustCall(function(req, res) {
|
const server = http.Server(common.mustCall((req, res) => {
|
||||||
assert.strictEqual(expectedRequests.shift(), req.url);
|
assert.strictEqual(expectedRequests.shift(), req.url);
|
||||||
|
|
||||||
switch (req.url) {
|
switch (req.url) {
|
||||||
@ -50,9 +50,9 @@ const server = http.Server(common.mustCall(function(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (expectedRequests.length === 0)
|
if (expectedRequests.length === 0)
|
||||||
this.close();
|
server.close();
|
||||||
|
|
||||||
req.on('end', function() {
|
req.on('end', () => {
|
||||||
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||||
res.write(`The path was ${url.parse(req.url).pathname}`);
|
res.write(`The path was ${url.parse(req.url).pathname}`);
|
||||||
res.end();
|
res.end();
|
||||||
@ -61,10 +61,10 @@ const server = http.Server(common.mustCall(function(req, res) {
|
|||||||
}, 3));
|
}, 3));
|
||||||
server.listen(0);
|
server.listen(0);
|
||||||
|
|
||||||
server.on('listening', function() {
|
server.on('listening', () => {
|
||||||
const agent = new http.Agent({ port: this.address().port, maxSockets: 1 });
|
const agent = new http.Agent({ port: server.address().port, maxSockets: 1 });
|
||||||
const req = http.get({
|
const req = http.get({
|
||||||
port: this.address().port,
|
port: server.address().port,
|
||||||
path: '/hello',
|
path: '/hello',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: '*/*',
|
Accept: '*/*',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user