@@ -20,7 +20,7 @@ function go(info : TestInfo, isValid : TestCallback, range : string, callback :
20
20
21
21
export default ( ( info , isValid ) =>
22
22
{
23
- const server = info . init ( 7 ) ;
23
+ const server = info . init ( 15 ) ;
24
24
25
25
go ( info , isValid , 'bytes=0-100' , ( statusCode , headers , body ) => {
26
26
isValid ( headers [ 'content-length' ] === content . length . toString ( ) , 'The content length returned must be a maximum the range could retrieve, but instead of ' + content . length + ', got ' + headers [ 'content-length' ] + '.' ) ;
@@ -49,5 +49,38 @@ export default ((info, isValid) =>
49
49
go ( info , isValid , 'bytes=' + ( content . length - 1 ) + '-' + ( content . length - 1 ) , ( statusCode , headers , body ) => {
50
50
isValid ( body === '!' , 'Expected "!" but got "' + body + '".' ) ;
51
51
} )
52
+
53
+ go ( info , isValid , 'bytes=0-' , ( statusCode , headers , body ) => {
54
+ isValid ( body === content , 'Expected "' + content + '" but got "' + body + '".' ) ;
55
+ } )
56
+
57
+ go ( info , isValid , 'bytes=1-' , ( statusCode , headers , body ) => {
58
+ const expected = content . substr ( 1 ) ;
59
+ isValid ( body === expected , 'Expected "' + expected + '" but got "' + body + '".' ) ;
60
+ } )
61
+
62
+ go ( info , isValid , 'bytes=100-' , ( statusCode , headers , body ) => {
63
+ isValid ( body === '' , 'Expected "" but got "' + body + '".' ) ;
64
+ } )
65
+
66
+ go ( info , isValid , 'bytes=-0' , ( statusCode , headers , body ) => {
67
+ isValid ( body === '' , 'Expected "" but got "' + body + '".' ) ;
68
+ } )
69
+
70
+ go ( info , isValid , 'bytes=-1' , ( statusCode , headers , body ) => {
71
+ isValid ( body === '!' , 'Expected "!" but got "' + body + '".' ) ;
72
+ } )
73
+
74
+ go ( info , isValid , 'bytes=-100' , ( statusCode , headers , body ) => {
75
+ isValid ( body === content , 'Expected "' + content + '" but got "' + body + '".' ) ;
76
+ } )
77
+
78
+ go ( info , isValid , 'bytes=0-0,1-1' , ( statusCode , headers , body ) => {
79
+ isValid ( / ^ - - [ ^ \n ] + \n [ ^ \n ] + \n [ ^ \n ] + \n \r \n H \r \n - - [ ^ \n ] + \n [ ^ \n ] + \n [ ^ \n ] + \n \r \n e \r \n - - [ ^ - ] + - - $ / . test ( body ) , 'Expected multipart "H -- e" but got "' + body + '".' ) ;
80
+ } )
81
+
82
+ go ( info , isValid , 'bytes=-1,1-1' , ( statusCode , headers , body ) => {
83
+ isValid ( / ^ - - [ ^ \n ] + \n [ ^ \n ] + \n [ ^ \n ] + \n \r \n ! \r \n - - [ ^ \n ] + \n [ ^ \n ] + \n [ ^ \n ] + \n \r \n e \r \n - - [ ^ - ] + - - $ / . test ( body ) , 'Expected multipart "! -- e" but got "' + body + '".' ) ;
84
+ } )
52
85
53
86
} ) as Test ;
0 commit comments