Skip to content

Commit

Permalink
fix: patch up grouped middleware bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Jan 12, 2023
1 parent a18b707 commit 77aee5d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Router.php
Expand Up @@ -97,6 +97,7 @@ public static function group(string $path, $handler)
*/
public static function match(string $methods, string $pattern, $handler)
{
$rawPattern = $pattern;
$pattern = static::$groupRoute . '/' . trim($pattern, '/');
$pattern = static::$groupRoute ? rtrim($pattern, '/') : $pattern;

Expand Down Expand Up @@ -143,7 +144,7 @@ public static function match(string $methods, string $pattern, $handler)
}

if ($routeOptions['middleware']) {
static::before($methods, $pattern, $routeOptions['middleware']);
static::before($methods, $rawPattern, $routeOptions['middleware']);
}
}

Expand Down

0 comments on commit 77aee5d

Please sign in to comment.