require header for incomplete uploads

This commit is contained in:
mertalev
2025-10-10 21:10:26 -04:00
parent 8d1a8b9465
commit 3c72409712

View File

@@ -115,7 +115,20 @@ describe(AssetUploadController.name, () => {
expect(body).toEqual(expect.objectContaining({ message: 'Expected valid upload-complete header' }));
});
it('should infer upload length from non-empty content length if complete upload', async () => {
it('should require Upload-Length header for incomplete upload', async () => {
const { status, body } = await request(ctx.getHttpServer())
.post('/upload')
.set('Upload-Draft-Interop-Version', '8')
.set('X-Immich-Asset-Data', makeAssetData())
.set('Repr-Digest', checksum)
.set('Upload-Complete', '?0')
.send(buffer);
expect(status).toBe(400);
expect(body).toEqual(expect.objectContaining({ message: 'Missing upload-length header' }));
});
it('should infer upload length from content length if complete upload', async () => {
const { status } = await request(ctx.getHttpServer())
.post('/upload')
.set('Upload-Draft-Interop-Version', '8')