This commit is contained in:
as2252258@163.com
2021-09-20 17:07:04 +08:00
parent 3f3556070d
commit e6cf4ec493
+6 -2
View File
@@ -2,6 +2,7 @@
namespace Http\Handler\Abstracts; namespace Http\Handler\Abstracts;
use Annotation\Inject;
use Http\Handler\Handler as CHl; use Http\Handler\Handler as CHl;
use Http\Message\ServerRequest; use Http\Message\ServerRequest;
use Kiri\Core\Help; use Kiri\Core\Help;
@@ -22,6 +23,9 @@ abstract class Handler implements RequestHandlerInterface
protected CHl $handler; protected CHl $handler;
#[Inject(AspectProxy::class)]
protected AspectProxy $aspectProxy;
protected ?array $middlewares; protected ?array $middlewares;
/** /**
@@ -75,8 +79,8 @@ abstract class Handler implements RequestHandlerInterface
*/ */
protected function dispatcher(ServerRequestInterface $request): mixed protected function dispatcher(ServerRequestInterface $request): mixed
{ {
$aspect = Kiri::getDi()->get(AspectProxy::class); $response = $this->aspectProxy->proxy($this->handler);
if (!(($response = $aspect->proxy($this->handler)) instanceof ResponseInterface)) { if (!($response instanceof ResponseInterface)) {
$response = $this->transferToResponse($response); $response = $this->transferToResponse($response);
} }
$response->withHeader('Run-Time', $this->_runTime($request)); $response->withHeader('Run-Time', $this->_runTime($request));