Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit af8e27d

Browse filesBrowse files
sreepurnajastiMylesBorins
authored andcommitted
test: Use common.mustCall in http test
PR-URL: #17487 Refs: #17169 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
1 parent 7f2764d commit af8e27d
Copy full SHA for af8e27d

File tree

Expand file treeCollapse file tree

1 file changed

+4
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-13
lines changed
Open diff view settings
Collapse file
+4-13Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
'use strict';
2-
require('../common');
3-
const assert = require('assert');
2+
const common = require('../common');
43
const http = require('http');
54
const net = require('net');
65

76
const COUNT = 10;
87

9-
let received = 0;
10-
11-
const server = http.createServer(function(req, res) {
8+
const server = http.createServer(common.mustCall((req, res) => {
129
// Close the server, we have only one TCP connection anyway
13-
if (received++ === 0)
14-
server.close();
15-
10+
server.close();
1611
res.writeHead(200);
1712
res.write('data');
1813

1914
setTimeout(function() {
2015
res.end();
2116
}, (Math.random() * 100) | 0);
22-
}).listen(0, function() {
17+
}, COUNT)).listen(0, function() {
2318
const s = net.connect(this.address().port);
2419

2520
const big = 'GET / HTTP/1.0\r\n\r\n'.repeat(COUNT);
2621

2722
s.write(big);
2823
s.resume();
2924
});
30-
31-
process.on('exit', function() {
32-
assert.strictEqual(received, COUNT);
33-
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.