Browse Source

Small clean up in test-http-client-race

v0.7.4-release
Ryan 16 years ago
parent
commit
89d891f912
  1. 20
      test/test-http-client-race.js

20
test/test-http-client-race.js

@ -1,14 +1,18 @@
include("mjsunit.js"); include("mjsunit.js");
PORT = 8888; PORT = 8888;
var body1_s = "1111111111111111";
var body2_s = "22222";
var server = new node.http.Server(function (req, res) { var server = new node.http.Server(function (req, res) {
res.sendHeader(200, [["content-type", "text/plain"]]); var body = req.uri.path === "/1" ? body1_s : body2_s;
if (req.uri.path == "/1") res.sendHeader(200, [
res.sendBody("hello world 1\n"); ["Content-Type", "text/plain"],
else ["Content-Length", body.length]
res.sendBody("hello world 2\n"); ]);
res.sendBody(body);
res.finish(); res.finish();
}) });
server.listen(PORT); server.listen(PORT);
var client = new node.http.Client(PORT); var client = new node.http.Client(PORT);
@ -33,6 +37,6 @@ client.get("/1").finish(function (res1) {
}); });
function onExit () { function onExit () {
assertEquals("hello world 1\n", body1); assertEquals(body1_s, body1);
assertEquals("hello world 2\n", body2); assertEquals(body2_s, body2);
} }

Loading…
Cancel
Save