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
sagirk 2018-11-19 15:39:20 +05:30 committed by Rich Trott
parent 0c64816c66
commit e610685c9d
1 changed files with 4 additions and 4 deletions

View File

@ -38,16 +38,16 @@ const server = http.createServer(function(request, response) {
this.close();
});
server.listen(0, common.mustCall(function() {
http.get({ port: this.address().port }, common.mustCall(function(res) {
server.listen(0, common.mustCall(() => {
http.get({ port: server.address().port }, common.mustCall((res) => {
let response = '';
assert.strictEqual(res.statusCode, 200);
res.setEncoding('ascii');
res.on('data', function(chunk) {
res.on('data', (chunk) => {
response += chunk;
});
res.on('end', common.mustCall(function() {
res.on('end', common.mustCall(() => {
assert.strictEqual(response, '1\n2\n3\n');
}));
}));