diff --git a/src/Client.php b/src/Client.php index c11c788..83ccafb 100644 --- a/src/Client.php +++ b/src/Client.php @@ -218,6 +218,8 @@ protected function execute(ServerRequestInterface $psr7Request): ResponseInterfa $middlewares = array_merge($middlewares, $registeredMiddlewares); } + $middlewares = MiddlewareManager::sortMiddlewares($middlewares); + try { $psr7Response = $this->dispatcher->dispatch($psr7Request, $middlewares, $this->coreMiddleware); } catch (Throwable $throwable) {