This commit is contained in:
2021-09-26 15:56:19 +08:00
parent 2a3338a41e
commit 5ec3916ff1
3 changed files with 38 additions and 22 deletions
+2 -5
View File
@@ -4,10 +4,8 @@ namespace Server\Service;
use Annotation\Inject;
use Co\Iterator;
use Exception;
use Http\Handler\Abstracts\HandlerManager;
use Http\Handler\Abstracts\MiddlewareManager;
use Http\Handler\Context;
use Http\Handler\Dispatcher;
use Http\Handler\Handler;
@@ -112,9 +110,8 @@ class Http implements OnCloseInterface, OnConnectInterface, OnRequestInterface
*/
protected function handler(Handler $handler, $PsrRequest): \Psr\Http\Message\ResponseInterface
{
$middlewares = MiddlewareManager::get($handler->callback);
$dispatcher = new Dispatcher($handler, $middlewares);
return $dispatcher->handle($PsrRequest);
$dispatcher = new Dispatcher($handler, $handler->_middlewares);
return $dispatcher->handle($PsrRequest);
}