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 @@ -28,26 +28,26 @@ if (!common.hasMultiLocalhost())
2828const http = require ( 'http' ) ;
2929const assert = require ( 'assert' ) ;
3030
31- const server = http . createServer ( function ( req , res ) {
31+ const server = http . createServer ( ( req , res ) => {
3232 console . log ( `Connect from: ${ req . connection . remoteAddress } ` ) ;
3333 assert . strictEqual ( req . connection . remoteAddress , '127.0.0.2' ) ;
3434
35- req . on ( 'end' , function ( ) {
35+ req . on ( 'end' , ( ) => {
3636 res . writeHead ( 200 , { 'Content-Type' : 'text/plain' } ) ;
3737 res . end ( `You are from: ${ req . connection . remoteAddress } ` ) ;
3838 } ) ;
3939 req . resume ( ) ;
4040} ) ;
4141
42- server . listen ( 0 , '127.0.0.1' , function ( ) {
42+ server . listen ( 0 , '127.0.0.1' , ( ) => {
4343 const options = { host : 'localhost' ,
44- port : this . address ( ) . port ,
44+ port : server . address ( ) . port ,
4545 path : '/' ,
4646 method : 'GET' ,
4747 localAddress : '127.0.0.2' } ;
4848
4949 const req = http . request ( options , function ( res ) {
50- res . on ( 'end' , function ( ) {
50+ res . on ( 'end' , ( ) => {
5151 server . close ( ) ;
5252 process . exit ( ) ;
5353 } ) ;
You can’t perform that action at this time.
0 commit comments