From 3f4d0fc76b165dca2c06cd595e48492ccef2a54b Mon Sep 17 00:00:00 2001 From: kou-hin Date: Sun, 26 Nov 2017 17:07:45 +0900 Subject: [PATCH] test: replace function with arrow function PR-URL: https://github.com/nodejs/node/pull/17305 Reviewed-By: Yosuke Furukawa Reviewed-By: Luigi Pinca Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- test/parallel/test-http.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js index d9fa581f3b55ce..52bebc476e1510 100644 --- a/test/parallel/test-http.js +++ b/test/parallel/test-http.js @@ -72,33 +72,33 @@ server.on('listening', function() { Cookie: [ 'foo=bar', 'bar=baz', 'baz=quux' ] }, agent: agent - }, common.mustCall(function(res) { + }, common.mustCall((res) => { const cookieHeaders = req._header.match(/^Cookie: .+$/img); assert.deepStrictEqual(cookieHeaders, ['Cookie: foo=bar; bar=baz; baz=quux']); assert.strictEqual(res.statusCode, 200); let body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { body += chunk; }); - res.on('end', common.mustCall(function() { + res.on('data', (chunk) => { body += chunk; }); + res.on('end', common.mustCall(() => { assert.strictEqual(body, 'The path was /hello'); })); })); - setTimeout(common.mustCall(function() { + setTimeout(common.mustCall(() => { const req = http.request({ port: server.address().port, method: 'PUT', path: '/there', agent: agent - }, common.mustCall(function(res) { + }, common.mustCall((res) => { const cookieHeaders = req._header.match(/^Cookie: .+$/img); assert.deepStrictEqual(cookieHeaders, ['Cookie: node=awesome; ta=da']); assert.strictEqual(res.statusCode, 200); let body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { body += chunk; }); - res.on('end', common.mustCall(function() { + res.on('data', (chunk) => { body += chunk; }); + res.on('end', common.mustCall(() => { assert.strictEqual(body, 'The path was /there'); })); })); @@ -106,7 +106,7 @@ server.on('listening', function() { req.end(); }), 1); - setTimeout(common.mustCall(function() { + setTimeout(common.mustCall(() => { const req = http.request({ port: server.address().port, method: 'POST', @@ -115,7 +115,7 @@ server.on('listening', function() { ['Cookie', 'def=456'], ['Cookie', 'ghi=789'] ], agent: agent - }, common.mustCall(function(res) { + }, common.mustCall((res) => { const cookieHeaders = req._header.match(/^Cookie: .+$/img); assert.deepStrictEqual(cookieHeaders, ['Cookie: abc=123', @@ -124,8 +124,8 @@ server.on('listening', function() { assert.strictEqual(res.statusCode, 200); let body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { body += chunk; }); - res.on('end', common.mustCall(function() { + res.on('data', (chunk) => { body += chunk; }); + res.on('end', common.mustCall(() => { assert.strictEqual(body, 'The path was /world'); })); }));