Skip to content

Commit 8237601

Browse files
codegaganBethGriggs
authored andcommitted
test: change anonymous function to arrow function
PR-URL: #24528 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 95a3b3e commit 8237601

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/parallel/test-http-client-timeout-agent.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const options = {
3232
host: '127.0.0.1',
3333
};
3434

35-
const server = http.createServer(function(req, res) {
35+
const server = http.createServer((req, res) => {
3636
const m = /\/(.*)/.exec(req.url);
3737
const reqid = parseInt(m[1], 10);
3838
if (reqid % 2) {
@@ -51,7 +51,7 @@ server.listen(0, options.host, function() {
5151
options.path = `/${requests_sent}`;
5252
const req = http.request(options);
5353
req.id = requests_sent;
54-
req.on('response', function(res) {
54+
req.on('response', (res) => {
5555
res.on('data', function(data) {
5656
console.log(`res#${this.req.id} data:${data}`);
5757
});
@@ -78,7 +78,7 @@ server.listen(0, options.host, function() {
7878

7979
setTimeout(function maybeDone() {
8080
if (requests_done >= requests_sent) {
81-
setTimeout(function() {
81+
setTimeout(() => {
8282
server.close();
8383
}, 100);
8484
} else {
@@ -87,7 +87,7 @@ server.listen(0, options.host, function() {
8787
}, 100);
8888
});
8989

90-
process.on('exit', function() {
90+
process.on('exit', () => {
9191
console.error(`done=${requests_done} sent=${requests_sent}`);
9292
// check that timeout on http request was not called too much
9393
assert.strictEqual(requests_done, requests_sent);

0 commit comments

Comments
 (0)