File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2- require ( '../common' ) ;
3- const assert = require ( 'assert' ) ;
2+ const common = require ( '../common' ) ;
43const http = require ( 'http' ) ;
54const net = require ( 'net' ) ;
65
76const 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- } ) ;
You can’t perform that action at this time.
0 commit comments