Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
test: add 'no response headers' http parser test
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Nov 17, 2011
1 parent 40cb398 commit 8f15582
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion test/simple/test-http-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,29 @@ function expectBody(expected) {
})();


//
// Response with no headers.
//
(function() {
var request = Buffer(
'HTTP/1.0 200 Connection established' + CRLF +
CRLF
);

var parser = newParser(RESPONSE);

parser.onHeadersComplete = mustCall(function(info) {
assert.equal(info.method, undefined);
assert.equal(info.versionMajor, 1);
assert.equal(info.versionMinor, 0);
assert.equal(info.statusCode, 200);
assert.deepEqual(info.headers || parser.headers, []);
});

parser.execute(request, 0, request.length);
})();


//
// Trailing headers.
//
Expand Down Expand Up @@ -481,7 +504,7 @@ function expectBody(expected) {


//
//
// Test parser reinit sequence.
//
(function() {
var req1 = Buffer(
Expand Down

0 comments on commit 8f15582

Please sign in to comment.