Skip to content

Commit 5ed7634

Browse files
committed
fix: remove duplicate matching
1 parent 383cfc7 commit 5ed7634

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Http/Http.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,14 @@ public function run(Container $context): static
542542
/** @var Response $response */
543543
$route = $this->match($request);
544544
/** @var ?Route $route */
545+
$this->matchedRoute = $route;
545546

546547
$this->activeRequests->add(1, [
547548
'http.request.method' => $request->getMethod(),
548549
'url.scheme' => $request->getProtocol(),
549550
]);
550551
$start = microtime(true);
551-
$result = $this->runInternal($context);
552+
$result = $this->runInternal($context, $route);
552553

553554
$requestDuration = microtime(true) - $start;
554555
$attributes = [
@@ -576,7 +577,7 @@ public function run(Container $context): static
576577
*
577578
* @param Container $context
578579
*/
579-
protected function runInternal(Container $context): static
580+
protected function runInternal(Container $context, ?Route $route): static
580581
{
581582
$request = $context->get('request');
582583
/** @var Request $request */
@@ -602,8 +603,6 @@ protected function runInternal(Container $context): static
602603
}
603604

604605
$method = $request->getMethod();
605-
$route = $this->match($request);
606-
$this->matchedRoute = $route;
607606
$groups = ($route instanceof Route) ? $route->getGroups() : [];
608607

609608
if (null === $route && null !== self::$wildcardRoute) {

0 commit comments

Comments
 (0)