feat: support ranged S3 GetObject responses

Wire createGetObjectResponse into single-part GetObject handler for
proper Range/Content-Range support (200, 206, 416). Update presigned
E2E test to require 200. Add SDK Range request test.
This commit is contained in:
asepharyana
2026-07-07 04:30:04 +07:00
parent 378a084fd3
commit ad45404132
4 changed files with 69 additions and 31 deletions
+9
View File
@@ -174,6 +174,15 @@ describe('S3 SDK compatibility', () => {
expect(ETag).toBeTruthy();
});
it('GetObject supports Range requests', async () => {
const { Body, ContentRange, ContentLength } = await s3.send(
new GetObjectCommand({ Bucket: BUCKET, Key: 'hello-sdk.txt', Range: 'bytes=0-4' }),
);
expect(ContentRange).toMatch(/^bytes 0-4\//);
expect(ContentLength).toBe(5);
expect(await Body!.transformToString()).toBe('Hello');
});
it('GetObject returns 404 (NoSuchKey) for missing key', async () => {
await expect(
s3.send(new GetObjectCommand({ Bucket: BUCKET, Key: 'does-not-exist.txt' })),