Skip to content

Commit

Permalink
Get test-http-response-no-headers.js to pass
Browse files Browse the repository at this point in the history
Main fix was in 3abebf which added HTTP/0.9 support to http parser.

Changed test because HTTP 1.1 mandates keep-alive when no headers are
given.

Fixes nodejs#1711
  • Loading branch information
felixge authored and alexkwolfe committed Dec 23, 2011
1 parent 1b2fd04 commit 58124c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/simple/test-http-response-no-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ var assert = require('assert');
var http = require('http');
var net = require('net');

var expected = 'I AM THE WALRUS';
var expected = {
'0.9': 'I AM THE WALRUS',
'1.0': 'I AM THE WALRUS',
'1.1': '',
}

var gotExpected = false;

Expand All @@ -34,7 +38,7 @@ function test(httpVersion, callback) {
});

var server = net.createServer(function(conn) {
var reply = 'HTTP/' + httpVersion + ' 200 OK\r\n\r\n' + expected;
var reply = 'HTTP/' + httpVersion + ' 200 OK\r\n\r\n' + expected[httpVersion];

conn.write(reply, function() {
conn.destroy();
Expand All @@ -55,7 +59,7 @@ function test(httpVersion, callback) {
});

res.on('end', function() {
assert.equal(body, expected);
assert.equal(body, expected[httpVersion]);
gotExpected = true;
server.close();
if (callback) process.nextTick(callback);
Expand Down

0 comments on commit 58124c3

Please sign in to comment.