diff --git a/src/Client.php b/src/Client.php index c830685..68e2287 100644 --- a/src/Client.php +++ b/src/Client.php @@ -210,6 +210,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) {