From 8a0e9cc1a7200a5196f7bba2d43d60c105bd96ff Mon Sep 17 00:00:00 2001 From: yathamravali Date: Fri, 11 Jan 2019 16:23:10 +0530 Subject: [PATCH 1/2] test: changed function to arrow function --- test/parallel/test-http.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js index e9a48c0fba3826..5481320109fae5 100644 --- a/test/parallel/test-http.js +++ b/test/parallel/test-http.js @@ -27,7 +27,7 @@ const url = require('url'); 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); switch (req.url) { @@ -52,7 +52,7 @@ const server = http.Server(common.mustCall(function(req, res) { if (expectedRequests.length === 0) this.close(); - req.on('end', function() { + req.on('end', () => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write(`The path was ${url.parse(req.url).pathname}`); res.end(); @@ -61,7 +61,7 @@ const server = http.Server(common.mustCall(function(req, res) { }, 3)); server.listen(0); -server.on('listening', function() { +server.on('listening', () => { const agent = new http.Agent({ port: this.address().port, maxSockets: 1 }); const req = http.get({ port: this.address().port, From 3ff4ab48abe11eab849d81f60f595cf79fdfae13 Mon Sep 17 00:00:00 2001 From: yathamravali Date: Fri, 11 Jan 2019 18:11:30 +0530 Subject: [PATCH 2/2] fixup: fixed test failure --- test/parallel/test-http.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js index 5481320109fae5..b4916efcc96cb0 100644 --- a/test/parallel/test-http.js +++ b/test/parallel/test-http.js @@ -50,7 +50,7 @@ const server = http.Server(common.mustCall((req, res) => { } if (expectedRequests.length === 0) - this.close(); + server.close(); req.on('end', () => { res.writeHead(200, { 'Content-Type': 'text/plain' }); @@ -62,9 +62,9 @@ const server = http.Server(common.mustCall((req, res) => { server.listen(0); 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({ - port: this.address().port, + port: server.address().port, path: '/hello', headers: { Accept: '*/*',