Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Small clean up in test-http-client-race

  • Loading branch information...
commit 89d891f91215da941f4bf16585aeb6ba95be663e 1 parent 61fcbb1
@ry ry authored
Showing with 12 additions and 8 deletions.
  1. +12 −8 test/test-http-client-race.js
View
20 test/test-http-client-race.js
@@ -1,14 +1,18 @@
include("mjsunit.js");
PORT = 8888;
+var body1_s = "1111111111111111";
+var body2_s = "22222";
+
var server = new node.http.Server(function (req, res) {
- res.sendHeader(200, [["content-type", "text/plain"]]);
- if (req.uri.path == "/1")
- res.sendBody("hello world 1\n");
- else
- res.sendBody("hello world 2\n");
+ var body = req.uri.path === "/1" ? body1_s : body2_s;
+ res.sendHeader(200, [
+ ["Content-Type", "text/plain"],
+ ["Content-Length", body.length]
+ ]);
+ res.sendBody(body);
res.finish();
-})
+});
server.listen(PORT);
var client = new node.http.Client(PORT);
@@ -33,6 +37,6 @@ client.get("/1").finish(function (res1) {
});
function onExit () {
- assertEquals("hello world 1\n", body1);
- assertEquals("hello world 2\n", body2);
+ assertEquals(body1_s, body1);
+ assertEquals(body2_s, body2);
}
Please sign in to comment.
Something went wrong with that request. Please try again.