Skip to content

Commit 89d891f

Browse files
committed
Small clean up in test-http-client-race
1 parent 61fcbb1 commit 89d891f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/test-http-client-race.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
include("mjsunit.js");
22
PORT = 8888;
33

4+
var body1_s = "1111111111111111";
5+
var body2_s = "22222";
6+
47
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);
1014
res.finish();
11-
})
15+
});
1216
server.listen(PORT);
1317

1418
var client = new node.http.Client(PORT);
@@ -33,6 +37,6 @@ client.get("/1").finish(function (res1) {
3337
});
3438

3539
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);
3842
}

0 commit comments

Comments
 (0)