test: favor arrow functions in callbacks

PR-URL: https://github.com/nodejs/node/pull/24425
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
UjjwalUpadhyay 2018-11-17 17:32:26 +05:30 committed by Rich Trott
parent 8450d11292
commit 6363f21faf

View File

@ -1,5 +1,6 @@
'use strict';
const common = require('../common');
const assert = require('assert');
if (!common.hasCrypto)
common.skip('missing crypto');
@ -14,7 +15,7 @@ const options = {
};
const server = https.Server(options, function(req, res) {
const server = https.Server(options, (req, res) => {
res.writeHead(200);
res.end('hello world\n');
});
@ -27,11 +28,11 @@ server.listen(0, function() {
rejectUnauthorized: true,
servername: 'agent1',
ca: options.ca
}, function(res) {
}, (res) => {
res.resume();
console.log(res.statusCode);
assert.strictEqual(res.statusCode, 200);
server.close();
}).on('error', function(e) {
}).on('error', (e) => {
console.log(e.message);
process.exit(1);
});