mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 04:39:37 +03:00
Removed exception catch that used to return a 500, and now returns a 404 due to a behavior change
This commit is contained in:
parent
c3c03a3a3b
commit
7530048fbd
3 changed files with 0 additions and 22 deletions
0
data/proxies/.gitignore
vendored
Normal file → Executable file
0
data/proxies/.gitignore
vendored
Normal file → Executable file
|
@ -78,8 +78,6 @@ class PreviewAction implements MiddlewareInterface
|
|||
return $this->generateImageResponse($imagePath);
|
||||
} catch (InvalidShortCodeException $e) {
|
||||
return $out($request, $response->withStatus(404), 'Not found');
|
||||
} catch (PreviewGenerationException $e) {
|
||||
return $out($request, $response->withStatus(500), 'Preview generation error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,24 +91,4 @@ class PreviewActionTest extends TestCase
|
|||
|
||||
$this->assertEquals(404, $resp->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function previewExceptionReturnsNotFound()
|
||||
{
|
||||
$shortCode = 'abc123';
|
||||
$this->urlShortener->shortCodeToUrl($shortCode)->willThrow(PreviewGenerationException::class)
|
||||
->shouldBeCalledTimes(1);
|
||||
|
||||
$resp = $this->action->__invoke(
|
||||
ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode),
|
||||
new Response(),
|
||||
function ($req, $resp) {
|
||||
return $resp;
|
||||
}
|
||||
);
|
||||
|
||||
$this->assertEquals(500, $resp->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue