@@ -32,7 +32,7 @@ const options = {
3232host : '127.0.0.1' ,
3333} ;
3434
35- const server = http . createServer ( function ( req , res ) {
35+ const server = http . createServer ( ( req , res ) => {
3636const m = / \/ ( .* ) / . exec ( req . url ) ;
3737const reqid = parseInt ( m [ 1 ] , 10 ) ;
3838if ( reqid % 2 ) {
@@ -51,7 +51,7 @@ server.listen(0, options.host, function() {
5151options . path = `/${ requests_sent } ` ;
5252const req = http . request ( options ) ;
5353req . id = requests_sent ;
54- req . on ( 'response' , function ( res ) {
54+ req . on ( 'response' , ( res ) => {
5555res . on ( 'data' , function ( data ) {
5656console . log ( `res#${ this . req . id } data:${ data } ` ) ;
5757} ) ;
@@ -78,7 +78,7 @@ server.listen(0, options.host, function() {
7878
7979setTimeout ( function maybeDone ( ) {
8080if ( requests_done >= requests_sent ) {
81- setTimeout ( function ( ) {
81+ setTimeout ( ( ) => {
8282server . 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' , ( ) => {
9191console . error ( `done=${ requests_done } sent=${ requests_sent } ` ) ;
9292// check that timeout on http request was not called too much
9393assert . strictEqual ( requests_done , requests_sent ) ;
0 commit comments