diff --git a/src/Base/NotFoundController.php b/src/Base/NotFoundController.php index e493379..1a23559 100644 --- a/src/Base/NotFoundController.php +++ b/src/Base/NotFoundController.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Kiri\Router\Base; +use Kiri\Di\Context; use Psr\Http\Message\ResponseInterface; class NotFoundController extends Controller @@ -15,10 +16,12 @@ class NotFoundController extends Controller */ public function fail(): ResponseInterface { + $response = Context::get(ResponseInterface::class); if ($this->request->getMethod() == 'OPTIONS') { - return \response()->withStatus(200, ""); + return $response->withStatus(200, ""); + } else { + return $response->withStatus(404, "not found page."); } - return \response()->withStatus(404, "not found page."); } }