Skip to content

Commit

Permalink
test: replace function with arrow function
Browse files Browse the repository at this point in the history
PR-URL: #17305
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
kou-hin authored and gibfahn committed Dec 19, 2017
1 parent 610164d commit 6b99341
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/parallel/test-http.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,41 +72,41 @@ 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');
}));
}));
req.setHeader('Cookie', ['node=awesome', 'ta=da']);
req.end();
}), 1);

setTimeout(common.mustCall(function() {
setTimeout(common.mustCall(() => {
const req = http.request({
port: server.address().port,
method: 'POST',
Expand All @@ -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',
Expand All @@ -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');
}));
}));
Expand Down

0 comments on commit 6b99341

Please sign in to comment.