eee
This commit is contained in:
@@ -15,6 +15,9 @@ class NotFoundController extends Controller
|
||||
*/
|
||||
public function fail(): ResponseInterface
|
||||
{
|
||||
if ($this->request->getMethod() == 'OPTIONS') {
|
||||
return $this->response->withStatus(200, "");
|
||||
}
|
||||
return $this->response->withStatus(404, "not found page.");
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,11 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->found = new Handler([di(NotFoundController::class), 'fail'], []);
|
||||
$found = di(NotFoundController::class);
|
||||
|
||||
$reflection = new \ReflectionMethod($found, 'fail');
|
||||
|
||||
$this->found = new Handler([$found, 'fail'], [], $reflection->getReturnType());
|
||||
}
|
||||
|
||||
|
||||
@@ -204,9 +208,6 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
|
||||
*/
|
||||
public function query(string $path, string $method): Handler
|
||||
{
|
||||
if ($method === 'OPTIONS') {
|
||||
$path = '/*';
|
||||
}
|
||||
return $this->methods[$method . '_' . $path] ?? $this->found;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user