File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,33 @@ describe('res', function(){
20
20
. expect ( 'Content-Disposition' , 'attachment; filename="user.html"' )
21
21
. expect ( 200 , '<p>{{user.name}}</p>' , done )
22
22
} )
23
+
24
+ it ( 'should accept range requests' , function ( done ) {
25
+ var app = express ( )
26
+
27
+ app . get ( '/' , function ( req , res ) {
28
+ res . download ( 'test/fixtures/user.html' )
29
+ } )
30
+
31
+ request ( app )
32
+ . get ( '/' )
33
+ . expect ( 'Accept-Ranges' , 'bytes' )
34
+ . expect ( 200 , '<p>{{user.name}}</p>' , done )
35
+ } )
36
+
37
+ it ( 'should respond with requested byte range' , function ( done ) {
38
+ var app = express ( )
39
+
40
+ app . get ( '/' , function ( req , res ) {
41
+ res . download ( 'test/fixtures/user.html' )
42
+ } )
43
+
44
+ request ( app )
45
+ . get ( '/' )
46
+ . set ( 'Range' , 'bytes=0-2' )
47
+ . expect ( 'Content-Range' , 'bytes 0-2/20' )
48
+ . expect ( 206 , '<p>' , done )
49
+ } )
23
50
} )
24
51
25
52
describe ( '.download(path, filename)' , function ( ) {
You can’t perform that action at this time.
0 commit comments