From b37318c1657beecfb82cd6b051da125f701ff539 Mon Sep 17 00:00:00 2001 From: routerman Date: Fri, 15 Dec 2017 20:59:40 +0900 Subject: [PATCH] test: change callback function to arrow function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/17697 Reviewed-By: Yosuke Furukawa Reviewed-By: Gireesh Punathil Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Jon Moss Reviewed-By: Ruben Bridgewater --- test/parallel/test-http-default-encoding.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-http-default-encoding.js b/test/parallel/test-http-default-encoding.js index 9fb0cca6563b36..36d3f0a65244fe 100644 --- a/test/parallel/test-http-default-encoding.js +++ b/test/parallel/test-http-default-encoding.js @@ -27,11 +27,11 @@ const http = require('http'); const expected = 'This is a unicode text: سلام'; let result = ''; -const server = http.Server(function(req, res) { +const server = http.Server((req, res) => { req.setEncoding('utf8'); - req.on('data', function(chunk) { + req.on('data', (chunk) => { result += chunk; - }).on('end', function() { + }).on('end', () => { server.close(); res.writeHead(200); res.end('hello world\n'); @@ -44,15 +44,15 @@ server.listen(0, function() { port: this.address().port, path: '/', method: 'POST' - }, function(res) { + }, (res) => { console.log(res.statusCode); res.resume(); - }).on('error', function(e) { + }).on('error', (e) => { console.log(e.message); process.exit(1); }).end(expected); }); -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(expected, result); });