Skip to content
Myr

tests: add range tests to res.download

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 00ad5be · Browse files · 1 file+27 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+27 added−0 removed

  • tests:+27 added−0 removed

1 file+27 added−0 removed

modified:test/res.download.js+27 added
18 unmodified lines
19 .expect('Content-Type', 'text/html; charset=UTF-8')20 .expect('Content-Disposition', 'attachment; filename="user.html"')21 .expect(200, '<p>{{user.name}}</p>', done)22 })2324 it('should accept range requests', function (done) {25 var app = express()2627 app.get('/', function (req, res) {28 res.download('test/fixtures/user.html')29 })3031 request(app)32 .get('/')33 .expect('Accept-Ranges', 'bytes')34 .expect(200, '<p>{{user.name}}</p>', done)35 })3637 it('should respond with requested byte range', function (done) {38 var app = express()3940 app.get('/', function (req, res) {41 res.download('test/fixtures/user.html')42 })4344 request(app)45 .get('/')46 .set('Range', 'bytes=0-2')47 .expect('Content-Range', 'bytes 0-2/20')48 .expect(206, '<p>', done)49 })50 })5152 describe('.download(path, filename)', function(){53 it('should provide an alternate filename', function(done){
177 unmodified lines