make nested router slugs work
This commit is contained in:
parent
5447f37cea
commit
b12616420b
1 changed files with 3 additions and 3 deletions
|
@ -13,16 +13,16 @@ public class Router : RouterBase
|
|||
|
||||
public override HttpMethod Method => HttpMethod.Any;
|
||||
|
||||
public override int Arguments => 1;
|
||||
public override int Arguments => 0;
|
||||
|
||||
protected override async Task<HttpResponse?> GetResponseInner(HttpRequest req, ArraySegment<string> path)
|
||||
{
|
||||
string next = path[0];
|
||||
string next = path.Count == 0 ? string.Empty : path[0];
|
||||
foreach (Route route in Routes)
|
||||
{
|
||||
if (route.Key == next || route.Key == null)
|
||||
{
|
||||
HttpResponse? resp = await route.Router.GetResponse(req, route.Key == null ? path : path[1..]);
|
||||
HttpResponse? resp = await route.Router.GetResponse(req, route.Key == null || path.Count == 0 ? path : path[1..]);
|
||||
if (resp != null)
|
||||
return resp;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue