@@ -32,7 +32,7 @@ const options = {
32
32
host : '127.0.0.1' ,
33
33
} ;
34
34
35
- const server = http . createServer ( function ( req , res ) {
35
+ const server = http . createServer ( ( req , res ) => {
36
36
const m = / \/ ( .* ) / . exec ( req . url ) ;
37
37
const reqid = parseInt ( m [ 1 ] , 10 ) ;
38
38
if ( reqid % 2 ) {
@@ -51,7 +51,7 @@ server.listen(0, options.host, function() {
51
51
options . path = `/${ requests_sent } ` ;
52
52
const req = http . request ( options ) ;
53
53
req . id = requests_sent ;
54
- req . on ( 'response' , function ( res ) {
54
+ req . on ( 'response' , ( res ) => {
55
55
res . on ( 'data' , function ( data ) {
56
56
console . log ( `res#${ this . req . id } data:${ data } ` ) ;
57
57
} ) ;
@@ -78,7 +78,7 @@ server.listen(0, options.host, function() {
78
78
79
79
setTimeout ( function maybeDone ( ) {
80
80
if ( requests_done >= requests_sent ) {
81
- setTimeout ( function ( ) {
81
+ setTimeout ( ( ) => {
82
82
server . close ( ) ;
83
83
} , 100 ) ;
84
84
} else {
@@ -87,7 +87,7 @@ server.listen(0, options.host, function() {
87
87
} , 100 ) ;
88
88
} ) ;
89
89
90
- process . on ( 'exit' , function ( ) {
90
+ process . on ( 'exit' , ( ) => {
91
91
console . error ( `done=${ requests_done } sent=${ requests_sent } ` ) ;
92
92
// check that timeout on http request was not called too much
93
93
assert . strictEqual ( requests_done , requests_sent ) ;
0 commit comments