Skip to content

Commit 131c778

Browse files
authored
Fix Resumable.js response code on test request (#43)
1 parent 645a29e commit 131c778

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/Driver/ResumableJsUploadDriver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\HttpFoundation\Response;
1515
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1616
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
17-
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1817

1918
class ResumableJsUploadDriver extends UploadDriver
2019
{
@@ -106,7 +105,7 @@ public function resume(Request $request, StorageConfig $config): Response
106105
$chunkname = $this->buildChunkname($range);
107106

108107
if (! $this->chunkExists($config, $filename, $chunkname)) {
109-
throw new NotFoundHttpException();
108+
return new Response('', Response::HTTP_NO_CONTENT);
110109
}
111110

112111
return new JsonResponse(['OK']);

tests/Driver/ResumableJsUploadDriverTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
use CodingSocks\ChunkUploader\Tests\TestCase;
1414
use CodingSocks\ChunkUploader\UploadHandler;
1515
use Mockery;
16+
use Symfony\Component\HttpFoundation\Response;
1617
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1718
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
18-
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1919

2020
class ResumableJsUploadDriverTest extends TestCase
2121
{
@@ -85,9 +85,8 @@ public function testResumeWhenChunkDoesNotExists()
8585
'resumableType' => 'text/plain',
8686
]);
8787

88-
$this->expectException(NotFoundHttpException::class);
89-
90-
$this->createTestResponse($this->handler->handle($request));
88+
$response = $this->createTestResponse($this->handler->handle($request));
89+
$response->assertStatus(Response::HTTP_NO_CONTENT);
9190
}
9291

9392
public function testResume()

0 commit comments

Comments
 (0)