Skip to content

Commit

Permalink
Fix issue when capturing routes with OPTIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Jan 12, 2024
1 parent e3cd43a commit 97ff74c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Routing/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ protected function match($method, $uri)
{
$routes = $this->router->routes();

$isOptions = $method === 'OPTIONS';

foreach ($routes as $route)
{
$regex = $route->getRegex();
Expand All @@ -125,8 +127,6 @@ protected function match($method, $uri)

$sameMethod = $route->getMethod() === $method;

$isOptions = $route->getMethod() === 'OPTIONS';

if ($matched && ($sameMethod || $isOptions))
{
return $route->setParams($matches);
Expand Down

0 comments on commit 97ff74c

Please sign in to comment.