Skip to content

Commit

Permalink
test: don't check the # of chunks in test-http-1.0
Browse files Browse the repository at this point in the history
As it can happen that the HTTP response is received in more than
one TCP chunk.

PR-URL: #3961
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
  • Loading branch information
santigimeno authored and jasnell committed Dec 17, 2015
1 parent 355edf5 commit 5f66d66
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions test/parallel/test-http-1.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ function test(handler, request_generator, response_validator) {
var server = http.createServer(handler);

var client_got_eof = false;
var server_response = {
data: '',
chunks: []
};
var server_response = '';

function cleanup() {
server.close();
Expand All @@ -36,8 +33,7 @@ function test(handler, request_generator, response_validator) {
});

c.on('data', function(chunk) {
server_response.data += chunk;
server_response.chunks.push(chunk);
server_response += chunk;
});

c.on('end', function() {
Expand Down Expand Up @@ -65,7 +61,7 @@ function test(handler, request_generator, response_validator) {
}

function response_validator(server_response, client_got_eof, timed_out) {
var m = server_response.data.split('\r\n\r\n');
var m = server_response.split('\r\n\r\n');
assert.equal(m[1], body);
assert.equal(true, client_got_eof);
assert.equal(false, timed_out);
Expand Down Expand Up @@ -107,8 +103,7 @@ function test(handler, request_generator, response_validator) {
'\r\n' +
'Hello, world!');

assert.equal(expected_response, server_response.data);
assert.equal(1, server_response.chunks.length);
assert.equal(expected_response, server_response);
assert.equal(true, client_got_eof);
assert.equal(false, timed_out);
}
Expand Down Expand Up @@ -151,8 +146,7 @@ function test(handler, request_generator, response_validator) {
'0\r\n' +
'\r\n');

assert.equal(expected_response, server_response.data);
assert.equal(1, server_response.chunks.length);
assert.equal(expected_response, server_response);
assert.equal(true, client_got_eof);
assert.equal(false, timed_out);
}
Expand Down

0 comments on commit 5f66d66

Please sign in to comment.