Skip to content

Commit

Permalink
Streamline code
Browse files Browse the repository at this point in the history
  • Loading branch information
tchowice committed Oct 26, 2024
1 parent 1d5b33d commit 7b8023c
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,15 @@ internal sealed class HttpRequestRouteHelper
{
// WebAPI attribute routing flows here. Use reflection to not take a dependency on microsoft.aspnet.webapi.core\[version]\lib\[framework]\System.Web.Http.

if (msSubRoutes is Array attributeRouting)
if (msSubRoutes is Array attributeRouting && attributeRouting.Length >= 1)
{
// There could be more than one subroute, each with a different method.
// But the template is the same across them, so we simply take the template
// from the first route.
if (attributeRouting.Length >= 1)
{
var subRouteData = attributeRouting.GetValue(0);
var subRouteData = attributeRouting.GetValue(0);

_ = this.routeFetcher.TryFetch(subRouteData, out var route);
_ = this.routeTemplateFetcher.TryFetch(route, out template);
}
_ = this.routeFetcher.TryFetch(subRouteData, out var route);
_ = this.routeTemplateFetcher.TryFetch(route, out template);
}
}
else if (routeData.Route is Route route)
Expand Down

0 comments on commit 7b8023c

Please sign in to comment.