This commit is contained in:
2023-09-15 15:54:52 +08:00
parent 77b5168880
commit 779cccd331
+5 -2
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Kiri\Router\Base; namespace Kiri\Router\Base;
use Kiri\Di\Context;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
class NotFoundController extends Controller class NotFoundController extends Controller
@@ -15,10 +16,12 @@ class NotFoundController extends Controller
*/ */
public function fail(): ResponseInterface public function fail(): ResponseInterface
{ {
$response = Context::get(ResponseInterface::class);
if ($this->request->getMethod() == 'OPTIONS') { 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.");
} }
} }