Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replace anonymous function with arrow function #24528

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/parallel/test-http-client-timeout-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const options = {
host: '127.0.0.1',
};

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

setTimeout(function maybeDone() {
if (requests_done >= requests_sent) {
setTimeout(function() {
setTimeout(() => {
server.close();
}, 100);
} else {
Expand All @@ -87,7 +87,7 @@ server.listen(0, options.host, function() {
}, 100);
});

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