File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -27,26 +27,26 @@ if (!common.hasMultiLocalhost())
2727const http = require ( 'http' ) ;
2828const assert = require ( 'assert' ) ;
2929
30- const server = http . createServer ( function ( req , res ) {
30+ const server = http . createServer ( ( req , res ) => {
3131 console . log ( `Connect from: ${ req . connection . remoteAddress } ` ) ;
3232 assert . strictEqual ( req . connection . remoteAddress , '127.0.0.2' ) ;
3333
34- req . on ( 'end' , function ( ) {
34+ req . on ( 'end' , ( ) => {
3535 res . writeHead ( 200 , { 'Content-Type' : 'text/plain' } ) ;
3636 res . end ( `You are from: ${ req . connection . remoteAddress } ` ) ;
3737 } ) ;
3838 req . resume ( ) ;
3939} ) ;
4040
41- server . listen ( 0 , '127.0.0.1' , function ( ) {
41+ server . listen ( 0 , '127.0.0.1' , ( ) => {
4242 const options = { host : 'localhost' ,
43- port : this . address ( ) . port ,
43+ port : server . address ( ) . port ,
4444 path : '/' ,
4545 method : 'GET' ,
4646 localAddress : '127.0.0.2' } ;
4747
4848 const req = http . request ( options , function ( res ) {
49- res . on ( 'end' , function ( ) {
49+ res . on ( 'end' , ( ) => {
5050 server . close ( ) ;
5151 process . exit ( ) ;
5252 } ) ;
You can’t perform that action at this time.
0 commit comments