mini\Dispatcher\HttpDispatcher::buildMiddlewareChain()
Method
private
Signature
private function buildMiddlewareChain(Psr\Http\Server\RequestHandlerInterface $handler): Psr\Http\Server\RequestHandlerInterface
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$handler |
Psr\Http\Server\RequestHandlerInterface |
required | Documentation missing |
Returns
Psr\Http\Server\RequestHandlerInterface
Documentation
Build middleware chain wrapper around the final handler
Wraps the handler (Router) with all registered middleware in reverse order to ensure FIFO execution (first added middleware executes first).
Each wrapper updates currentServerRequest when handle() is called, so that mini\request() and $_GET/$_POST proxies always reflect the latest request as it flows through middleware. This enables middleware like JSON body parsers to make their changes visible to $_POST and request()->getParsedBody().