File tree 1 file changed +12
-8
lines changed
1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 1
1
include ( "mjsunit.js" ) ;
2
2
PORT = 8888 ;
3
3
4
+ var body1_s = "1111111111111111" ;
5
+ var body2_s = "22222" ;
6
+
4
7
var server = new node . http . Server ( function ( req , res ) {
5
- res . sendHeader ( 200 , [ [ "content-type" , "text/plain" ] ] ) ;
6
- if ( req . uri . path == "/1" )
7
- res . sendBody ( "hello world 1\n" ) ;
8
- else
9
- res . sendBody ( "hello world 2\n" ) ;
8
+ var body = req . uri . path === "/1" ? body1_s : body2_s ;
9
+ res . sendHeader ( 200 , [
10
+ [ "Content-Type" , "text/plain" ] ,
11
+ [ "Content-Length" , body . length ]
12
+ ] ) ;
13
+ res . sendBody ( body ) ;
10
14
res . finish ( ) ;
11
- } )
15
+ } ) ;
12
16
server . listen ( PORT ) ;
13
17
14
18
var client = new node . http . Client ( PORT ) ;
@@ -33,6 +37,6 @@ client.get("/1").finish(function (res1) {
33
37
} ) ;
34
38
35
39
function onExit ( ) {
36
- assertEquals ( "hello world 1\n" , body1 ) ;
37
- assertEquals ( "hello world 2\n" , body2 ) ;
40
+ assertEquals ( body1_s , body1 ) ;
41
+ assertEquals ( body2_s , body2 ) ;
38
42
}
You can’t perform that action at this time.
0 commit comments