mirror of https://github.com/nodejs/node.git
test: refactor test-http-write-empty-string to use arrow functions
In `test/parallel/test-http-write-empty-string.js`, callbacks use anonymous closure functions. Replace them with arrow functions. PR-URL: https://github.com/nodejs/node/pull/24483 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>pull/24558/head
parent
0c64816c66
commit
e610685c9d
|
@ -38,16 +38,16 @@ const server = http.createServer(function(request, response) {
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(0, common.mustCall(function() {
|
server.listen(0, common.mustCall(() => {
|
||||||
http.get({ port: this.address().port }, common.mustCall(function(res) {
|
http.get({ port: server.address().port }, common.mustCall((res) => {
|
||||||
let response = '';
|
let response = '';
|
||||||
|
|
||||||
assert.strictEqual(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
res.setEncoding('ascii');
|
res.setEncoding('ascii');
|
||||||
res.on('data', function(chunk) {
|
res.on('data', (chunk) => {
|
||||||
response += chunk;
|
response += chunk;
|
||||||
});
|
});
|
||||||
res.on('end', common.mustCall(function() {
|
res.on('end', common.mustCall(() => {
|
||||||
assert.strictEqual(response, '1\n2\n3\n');
|
assert.strictEqual(response, '1\n2\n3\n');
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue