diff --git a/flight/net/Route.php b/flight/net/Route.php index 8294a19..47f93dc 100644 --- a/flight/net/Route.php +++ b/flight/net/Route.php @@ -87,7 +87,7 @@ class Route */ public function __construct(string $pattern, $callback, array $methods, bool $pass, string $alias = '') { - $this->pattern = $pattern; + $this->pattern = str_replace('//', '/', $pattern); $this->callback = $callback; $this->methods = $methods; $this->pass = $pass; diff --git a/tests/FlightTest.php b/tests/FlightTest.php index 990bf93..0c9a7d7 100644 --- a/tests/FlightTest.php +++ b/tests/FlightTest.php @@ -134,6 +134,21 @@ class FlightTest extends TestCase Flight::start(); } + public function testStaticNestedGroups(): void { + Flight::group('/', static function (): void { + Flight::group('/', static function (): void { + Flight::route('GET /', static function (): void { + echo "test"; + }); + }); + }); + + Flight::request()->url = '/'; + + $this->expectOutputString('test'); + Flight::start(); + } + public function testStaticRouteGet() {