改名
This commit is contained in:
@@ -476,22 +476,17 @@ class Router extends Application implements RouterInterface
|
|||||||
public function dispatch()
|
public function dispatch()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($this->reading) {
|
if (!($node = $this->find_path(\request()))) {
|
||||||
$response = send(self::NOT_FOUND, 502);
|
return send(self::NOT_FOUND, 404);
|
||||||
} else if (!($node = $this->find_path(\request()))) {
|
}
|
||||||
$response = send(self::NOT_FOUND, 404);
|
send($node->dispatch(), 200);
|
||||||
} else {
|
if ($node->hasAfter()) {
|
||||||
$response = send($node->dispatch(), 200);
|
$node->afterDispatch(\request());
|
||||||
}
|
}
|
||||||
} catch (ExitException $exception) {
|
} catch (ExitException $exception) {
|
||||||
$response = send($exception->getMessage(), $exception->getCode());
|
send($exception->getMessage(), $exception->getCode());
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$response = send($this->exception($exception), 200);
|
send($this->exception($exception), 200);
|
||||||
} finally {
|
|
||||||
if (!isset($node) || !($node instanceof Node)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$node->hasAfter() && $node->afterDispatch($response ?? null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user