@@ -8,17 +8,17 @@ let resultServer = '';
8
8
const expectedClient = 'Response Body from Server' ;
9
9
let resultClient = '' ;
10
10
11
- const server = http . createServer ( function ( req , res ) {
11
+ const server = http . createServer ( ( req , res ) => {
12
12
console . error ( 'pause server request' ) ;
13
13
req . pause ( ) ;
14
- setTimeout ( function ( ) {
14
+ setTimeout ( ( ) => {
15
15
console . error ( 'resume server request' ) ;
16
16
req . resume ( ) ;
17
17
req . setEncoding ( 'utf8' ) ;
18
- req . on ( 'data' , function ( chunk ) {
18
+ req . on ( 'data' , ( chunk ) => {
19
19
resultServer += chunk ;
20
20
} ) ;
21
- req . on ( 'end' , function ( ) {
21
+ req . on ( 'end' , ( ) => {
22
22
console . error ( resultServer ) ;
23
23
res . writeHead ( 200 ) ;
24
24
res . end ( expectedClient ) ;
@@ -31,16 +31,16 @@ server.listen(0, function() {
31
31
port : this . address ( ) . port ,
32
32
path : '/' ,
33
33
method : 'POST'
34
- } , function ( res ) {
34
+ } , ( res ) => {
35
35
console . error ( 'pause client response' ) ;
36
36
res . pause ( ) ;
37
- setTimeout ( function ( ) {
37
+ setTimeout ( ( ) => {
38
38
console . error ( 'resume client response' ) ;
39
39
res . resume ( ) ;
40
- res . on ( 'data' , function ( chunk ) {
40
+ res . on ( 'data' , ( chunk ) => {
41
41
resultClient += chunk ;
42
42
} ) ;
43
- res . on ( 'end' , function ( ) {
43
+ res . on ( 'end' , ( ) => {
44
44
console . error ( resultClient ) ;
45
45
server . close ( ) ;
46
46
} ) ;
@@ -49,7 +49,7 @@ server.listen(0, function() {
49
49
req . end ( expectedServer ) ;
50
50
} ) ;
51
51
52
- process . on ( 'exit' , function ( ) {
52
+ process . on ( 'exit' , ( ) => {
53
53
assert . strictEqual ( expectedServer , resultServer ) ;
54
54
assert . strictEqual ( expectedClient , resultClient ) ;
55
55
} ) ;
0 commit comments