diff --git a/test/res.download.js b/test/res.download.js index cf3b3ca53e..658d80af4f 100644 --- a/test/res.download.js +++ b/test/res.download.js @@ -20,6 +20,33 @@ describe('res', function(){ .expect('Content-Disposition', 'attachment; filename="user.html"') .expect(200, '
{{user.name}}
', done) }) + + it('should accept range requests', function (done) { + var app = express() + + app.get('/', function (req, res) { + res.download('test/fixtures/user.html') + }) + + request(app) + .get('/') + .expect('Accept-Ranges', 'bytes') + .expect(200, '{{user.name}}
', done) + }) + + it('should respond with requested byte range', function (done) { + var app = express() + + app.get('/', function (req, res) { + res.download('test/fixtures/user.html') + }) + + request(app) + .get('/') + .set('Range', 'bytes=0-2') + .expect('Content-Range', 'bytes 0-2/20') + .expect(206, '', done) + }) }) describe('.download(path, filename)', function(){