File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -889,7 +889,7 @@ function schemeFetch (fetchParams) {
889889
890890 // 8. Let slicedBlob be the result of invoking slice blob given blob, rangeStart,
891891 // rangeEnd + 1, and type.
892- const slicedBlob = blob . slice ( rangeStart , rangeEnd , type )
892+ const slicedBlob = blob . slice ( rangeStart , rangeEnd + 1 , type )
893893
894894 // 9. Let slicedBodyWithType be the result of safely extracting slicedBlob.
895895 // Note: same reason as mentioned above as to why we use extractBody
Original file line number Diff line number Diff line change @@ -23,6 +23,19 @@ test('fetching blob: uris', async (t) => {
2323 t . assert . strictEqual ( `${ blob . size } ` , res . headers . get ( 'Content-Length' ) )
2424 } )
2525
26+ await t . test ( 'a range fetch request returns the inclusive byte range' , async ( ) => {
27+ const res = await fetch ( objectURL , {
28+ headers : {
29+ Range : 'bytes=1-3'
30+ }
31+ } )
32+
33+ t . assert . strictEqual ( res . status , 206 )
34+ t . assert . strictEqual ( await res . text ( ) , blobContents . slice ( 1 , 4 ) )
35+ t . assert . strictEqual ( res . headers . get ( 'Content-Length' ) , '3' )
36+ t . assert . strictEqual ( res . headers . get ( 'Content-Range' ) , `bytes 1-3/${ blob . size } ` )
37+ } )
38+
2639 await t . test ( 'non-GET method to blob: fails' , async ( ) => {
2740 try {
2841 await fetch ( objectURL , {
You can’t perform that action at this time.
0 commit comments