This commit is contained in:
2021-09-18 13:45:33 +08:00
parent c5afc4647e
commit a6f056b8c8
2 changed files with 25 additions and 3 deletions
+6 -1
View File
@@ -3,6 +3,7 @@
namespace Server\Service;
use Annotation\Inject;
use Exception;
use Http\Context\Context;
use Http\Exception\RequestException;
@@ -35,6 +36,10 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect
{
#[Inject(Dispatcher::class)]
public Dispatcher $dispatcher;
/**
* @param Server $server
* @param int $fd
@@ -83,7 +88,7 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect
{
$middlewares = MiddlewareManager::get($handler->callback);
$dispatcher = new Dispatcher($handler, $middlewares);
$dispatcher = $this->dispatcher->setHandler($handler)->setMiddlewares($middlewares);
return $dispatcher->handle($PsrRequest);
}