File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,11 @@ const http = require('http');
6
6
const expected = 'This is a unicode text: سلام' ;
7
7
let result = '' ;
8
8
9
- const server = http . Server ( function ( req , res ) {
9
+ const server = http . Server ( ( req , res ) => {
10
10
req . setEncoding ( 'utf8' ) ;
11
- req . on ( 'data' , function ( chunk ) {
11
+ req . on ( 'data' , ( chunk ) => {
12
12
result += chunk ;
13
- } ) . on ( 'end' , function ( ) {
13
+ } ) . on ( 'end' , ( ) => {
14
14
server . close ( ) ;
15
15
res . writeHead ( 200 ) ;
16
16
res . end ( 'hello world\n' ) ;
@@ -23,15 +23,15 @@ server.listen(0, function() {
23
23
port : this . address ( ) . port ,
24
24
path : '/' ,
25
25
method : 'POST'
26
- } , function ( res ) {
26
+ } , ( res ) => {
27
27
console . log ( res . statusCode ) ;
28
28
res . resume ( ) ;
29
- } ) . on ( 'error' , function ( e ) {
29
+ } ) . on ( 'error' , ( e ) => {
30
30
console . log ( e . message ) ;
31
31
process . exit ( 1 ) ;
32
32
} ) . end ( expected ) ;
33
33
} ) ;
34
34
35
- process . on ( 'exit' , function ( ) {
35
+ process . on ( 'exit' , ( ) => {
36
36
assert . strictEqual ( expected , result ) ;
37
37
} ) ;
You can’t perform that action at this time.
0 commit comments