diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 7491fcdc..0ee00bcf 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -532,6 +532,9 @@ class Node extends HttpService if ($this->handler instanceof Closure) { return call_user_func($this->handler, ...$dispatchParams); } + + var_dump($dispatchParams); + $validator = $this->getValidator(); if (!($validator instanceof Validator)) { return call_user_func($this->callback, ...$dispatchParams); diff --git a/HttpServer/Route/Reduce.php b/HttpServer/Route/Reduce.php index b8b81452..dfe94bee 100644 --- a/HttpServer/Route/Reduce.php +++ b/HttpServer/Route/Reduce.php @@ -52,13 +52,24 @@ class Reduce private static function core(): Closure { return function ($stack, $pipe) { - return function ($passable) use ($stack, $pipe) { - if ($pipe instanceof Middleware) { - return $pipe->onHandler($passable, $stack); - } else { - return call_user_func($pipe, $passable, $stack); - } - }; + return static::passable($stack, $pipe); + }; + } + + + /** + * @param $stack + * @param $pipe + * @return Closure + */ + public static function passable($stack, $pipe): Closure + { + return function ($passable) use ($stack, $pipe) { + if (!($pipe instanceof Middleware)) { + return call_user_func($pipe, $passable, $stack); + } else { + return $pipe->onHandler($passable, $stack); + } }; }