Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: replace Function with Arrow Function in test-http.js
  • Loading branch information
kou-hin
kou-hin committed Nov 26, 2017
commit 58a27934566ff148b49cfb006f5d9a74317a51fc
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