@@ -10,6 +10,7 @@ const object = 'mpu-test-object';
1010const emptyObject = 'empty-object' ;
1111const nonMpuObject = 'simple-object' ;
1212
13+ /** 5MiB */
1314const bodySize = 1024 * 1024 * 5 ;
1415const bodyContent = 'a' ;
1516const howManyParts = 3 ;
@@ -18,6 +19,13 @@ const invalidPartNumbers = [-1, 0, maximumAllowedPartCount + 1];
1819
1920let ETags = [ ] ;
2021
22+ // Because HEAD has no body, the SDK (v2) returns a generic code such as:
23+ // 400 BadRequest
24+ // 403 Forbidden
25+ // 404 NotFound
26+ // ...
27+ // It will fall back to HTTP statusCode
28+ // Example: 416 InvalidRange will be 416 416
2129function checkError ( err , statusCode , code ) {
2230 assert . strictEqual ( err . statusCode , statusCode ) ;
2331 assert . strictEqual ( err . code , code ) ;
@@ -174,7 +182,7 @@ describe('Part size tests with object head', () => {
174182
175183 it ( 'should return an error when requesting part 2 of empty object' , done => {
176184 headObject ( { Key : emptyObject , PartNumber : 2 } , ( err , data ) => {
177- checkError ( err , 416 , 'InvalidRange' ) ;
185+ checkError ( err , 416 , 416 ) ;
178186 assert . strictEqual ( data , null ) ;
179187 done ( ) ;
180188 } ) ;
@@ -183,15 +191,15 @@ describe('Part size tests with object head', () => {
183191 it ( 'should return content-length requesting part 1 of non-MPU object' , done => {
184192 headObject ( { Key : nonMpuObject , PartNumber : 1 } , ( err , data ) => {
185193 checkNoError ( err ) ;
186- assert . strictEqual ( data . ContentLength , 0 ) ;
194+ assert . strictEqual ( data . ContentLength , bodySize ) ;
187195 done ( ) ;
188196 } ) ;
189197 } ) ;
190198
191199 it ( 'should return an error when requesting part 2 of non-MPU object' , done => {
192- headObject ( { Key : nonMpuObject , PartNumber : 1 } , ( err , data ) => {
193- checkError ( err , 416 , 'InvalidRange' ) ;
194- assert . strictEqual ( data . ContentLength , bodySize ) ;
200+ headObject ( { Key : nonMpuObject , PartNumber : 2 } , ( err , data ) => {
201+ checkError ( err , 416 , 416 ) ;
202+ assert . strictEqual ( data , null ) ;
195203 done ( ) ;
196204 } ) ;
197205 } ) ;
0 commit comments