Skip to content

Commit

Permalink
修复
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Jul 16, 2024
1 parent ddeb2c9 commit 764694f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Server/Http/Listener/HttpRouteInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected function parseAnnotations(): void
$context['server'] = $server;
/** @var HttpRoute $route */
$route = $server->getBean('HttpRoute');
$autoEndSlash = $route->getAutoEndSlash();
foreach ($controllerParser->getByServer($name) as $className => $classItem)
{
/** @var \Imi\Server\Http\Route\Annotation\Controller $classAnnotation */
Expand Down Expand Up @@ -173,6 +172,12 @@ protected function parseAnnotations(): void
'extractData' => $extractData,
];
$route->addRuleAnnotation($routeItem, $routeCallable, $options);
if ($routeItem->autoEndSlash && !str_ends_with($routeItem->url, '/'))
{
$routeItem = clone $routeItem;
$routeItem->url .= '/';
$route->addRuleAnnotation($routeItem, $routeCallable, $options);
}
}
}
}
Expand Down

0 comments on commit 764694f

Please sign in to comment.