From 276250f0a36e00373166d91d539e5220d6f158c7 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Mon, 25 Oct 2021 17:42:20 +0200 Subject: prevent multiple post-process triggering of upload-resumable (#4175) * prevent multiple post-process triggering of upload-resumable * switch from 409 to 503 for upload being processed * Improve resumable upload check Co-authored-by: Chocobozzz --- server/tests/api/videos/resumable-upload.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'server/tests/api/videos') diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts index 59970aa94..6b5e0c09d 100644 --- a/server/tests/api/videos/resumable-upload.ts +++ b/server/tests/api/videos/resumable-upload.ts @@ -180,6 +180,21 @@ describe('Test resumable upload', function () { await sendChunks({ pathUploadId: uploadId, expectedStatus, contentRangeBuilder, contentLength: size }) await checkFileSize(uploadId, 0) }) + + it('Should be able to accept 2 PUT requests', async function () { + const uploadId = await prepareUpload() + + const result1 = await sendChunks({ pathUploadId: uploadId }) + const result2 = await sendChunks({ pathUploadId: uploadId }) + + expect(result1.body.video.uuid).to.exist + expect(result1.body.video.uuid).to.equal(result2.body.video.uuid) + + expect(result1.headers['x-resumable-upload-cached']).to.not.exist + expect(result2.headers['x-resumable-upload-cached']).to.equal('true') + + await checkFileSize(uploadId, null) + }) }) after(async function () { -- cgit v1.2.3