Skip to content

Commit

Permalink
passing test for open-ended range
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Dec 1, 2014
1 parent c448273 commit 21175da
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/range.js
Expand Up @@ -80,3 +80,24 @@ test('flipped range', function (t) {
});
});
});

test('partial range', function (t) {
t.plan(5);
var server = http.createServer(ecstatic(__dirname + '/public/subdir'));
t.on('end', function () { server.close() })

server.listen(0, function () {
var port = server.address().port;
var opts = {
uri: 'http://localhost:' + port + '/e.html',
headers: { range: '3-' }
};
request.get(opts, function (err, res, body) {
t.ifError(err);
t.equal(res.statusCode, 206, 'partial content status code');
t.equal(body, 'e!!</b>\n');
t.equal(parseInt(res.headers['content-length']), body.length);
t.equal(res.headers['content-range'], 'bytes 3-10/11');
});
});
});

0 comments on commit 21175da

Please sign in to comment.