Skip to content

Commit

Permalink
Save the matched Route object as an atribute on the request
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderdlm committed Aug 18, 2023
1 parent b2d82a8 commit 494a42f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ public function dispatchRequest(ServerRequestInterface $request): ResponseInterf
case FastRoute::FOUND:
$route = $this->ensureHandlerIsRoute($match[1], $method, $uri)->setVars($match[2]);

if ($this->isExtraConditionMatch($route, $request)) {
$request = $request->withAttribute('route', $route);

if ($this->isExtraConditionMatch($route, $request)) {
$this->setFoundMiddleware($route);
$request = $this->requestWithRouteAttributes($request, $route);
break;
Expand Down

0 comments on commit 494a42f

Please sign in to comment.