[spiral/router] Incorrect Concatenation of Route Pattern with Prefix in Route Group
butschster opened this issue · 0 comments
butschster commented
When using a route group with a set prefix and attempting to add a new action to the route, the router does not handle the URL properly. It seems the leading slash in the route pattern is causing an issue in concatenating with the prefix. As a result, the expected URL pattern is not generated.
Code to Reproduce:
// Setting Prefix for Group
$groups->getGroup('api')->setPrefix('api');
// Adding Route to the Group
#[Route(route: '/v1/auth/login', methods: ['POST'], group: 'api')]
public function login(...)
{
// ....
}
The URL pattern is not generated as expected. Developers have to manually remove the leading slash from the route pattern like v1/auth/login
.
The framework should handle the concatenation of the route pattern with the prefix properly, considering both scenarios with and without the leading slash.