Defined custom NotFoundMiddleware for rest routes

This commit is contained in:
Alejandro Celaya
2016-07-26 19:09:54 +02:00
parent 83f29080c6
commit a81dba58bd
7 changed files with 88 additions and 18 deletions

View File

@@ -67,8 +67,8 @@ class RedirectMiddleware implements MiddlewareInterface
try {
$longUrl = $this->urlShortener->shortCodeToUrl($shortCode);
// If provided shortCode does not belong to a valid long URL, dispatch next middleware, which is 404
// middleware
// If provided shortCode does not belong to a valid long URL, dispatch next middleware, which will trigger
// a not-found error
if (! isset($longUrl)) {
return $out($request, $response);
}