@@ -29,17 +29,17 @@ let resultServer = '';
29
29
const expectedClient = 'Response Body from Server' ;
30
30
let resultClient = '' ;
31
31
32
- const server = http . createServer ( function ( req , res ) {
32
+ const server = http . createServer ( ( req , res ) => {
33
33
console . error ( 'pause server request' ) ;
34
34
req . pause ( ) ;
35
- setTimeout ( function ( ) {
35
+ setTimeout ( ( ) => {
36
36
console . error ( 'resume server request' ) ;
37
37
req . resume ( ) ;
38
38
req . setEncoding ( 'utf8' ) ;
39
- req . on ( 'data' , function ( chunk ) {
39
+ req . on ( 'data' , ( chunk ) => {
40
40
resultServer += chunk ;
41
41
} ) ;
42
- req . on ( 'end' , function ( ) {
42
+ req . on ( 'end' , ( ) => {
43
43
console . error ( resultServer ) ;
44
44
res . writeHead ( 200 ) ;
45
45
res . end ( expectedClient ) ;
@@ -52,16 +52,16 @@ server.listen(0, function() {
52
52
port : this . address ( ) . port ,
53
53
path : '/' ,
54
54
method : 'POST'
55
- } , function ( res ) {
55
+ } , ( res ) => {
56
56
console . error ( 'pause client response' ) ;
57
57
res . pause ( ) ;
58
- setTimeout ( function ( ) {
58
+ setTimeout ( ( ) => {
59
59
console . error ( 'resume client response' ) ;
60
60
res . resume ( ) ;
61
- res . on ( 'data' , function ( chunk ) {
61
+ res . on ( 'data' , ( chunk ) => {
62
62
resultClient += chunk ;
63
63
} ) ;
64
- res . on ( 'end' , function ( ) {
64
+ res . on ( 'end' , ( ) => {
65
65
console . error ( resultClient ) ;
66
66
server . close ( ) ;
67
67
} ) ;
@@ -70,7 +70,7 @@ server.listen(0, function() {
70
70
req . end ( expectedServer ) ;
71
71
} ) ;
72
72
73
- process . on ( 'exit' , function ( ) {
73
+ process . on ( 'exit' , ( ) => {
74
74
assert . strictEqual ( expectedServer , resultServer ) ;
75
75
assert . strictEqual ( expectedClient , resultClient ) ;
76
76
} ) ;
0 commit comments