Skip to content

Commit

Permalink
test: replace callback with arrow functions
Browse files Browse the repository at this point in the history
PR-URL: #24434
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
prodroy1 authored and BethGriggs committed Feb 11, 2019
1 parent dd5bfd7 commit 1658924
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/parallel/test-https-close.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ const options = {

const connections = {};

const server = https.createServer(options, function(req, res) {
const interval = setInterval(function() {
const server = https.createServer(options, (req, res) => {
const interval = setInterval(() => {
res.write('data');
}, 1000);
interval.unref();
});

server.on('connection', function(connection) {
server.on('connection', (connection) => {
const key = `${connection.remoteAddress}:${connection.remotePort}`;
connection.on('close', function() {
connection.on('close', () => {
delete connections[key];
});
connections[key] = connection;
Expand All @@ -37,16 +37,16 @@ function shutdown() {
}
}

server.listen(0, function() {
server.listen(0, () => {
const requestOptions = {
hostname: '127.0.0.1',
port: this.address().port,
port: server.address().port,
path: '/',
method: 'GET',
rejectUnauthorized: false
};

const req = https.request(requestOptions, function(res) {
const req = https.request(requestOptions, (res) => {
res.on('data', () => {});
setImmediate(shutdown);
});
Expand Down

0 comments on commit 1658924

Please sign in to comment.