Merge branch 'merge/release/2.2-to-master'
This commit is contained in:
commit
1e9640fcad
|
|
@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore.Routing
|
|||
{
|
||||
var matchProcessorReference = endpoint.MatchProcessorReferences[i];
|
||||
var parameter = endpoint.ParsedTemplate.GetParameter(matchProcessorReference.ParameterName);
|
||||
if (parameter.IsOptional && !routeValues.ContainsKey(parameter.Name))
|
||||
if (parameter != null && parameter.IsOptional && !routeValues.ContainsKey(parameter.Name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Builder;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing.Constraints;
|
||||
using Microsoft.AspNetCore.Routing.Internal;
|
||||
using Microsoft.AspNetCore.Routing.TestObjects;
|
||||
using Microsoft.AspNetCore.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -1843,21 +1844,5 @@ namespace Microsoft.AspNetCore.Routing
|
|||
|
||||
return new DefaultInlineConstraintResolver(routeOptions.Object);
|
||||
}
|
||||
|
||||
private class CapturingConstraint : IRouteConstraint
|
||||
{
|
||||
public IDictionary<string, object> Values { get; private set; }
|
||||
|
||||
public bool Match(
|
||||
HttpContext httpContext,
|
||||
IRouter route,
|
||||
string routeKey,
|
||||
RouteValueDictionary values,
|
||||
RouteDirection routeDirection)
|
||||
{
|
||||
Values = new RouteValueDictionary(values);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Microsoft.AspNetCore.Routing.TestObjects
|
||||
{
|
||||
internal class CapturingConstraint : IRouteConstraint
|
||||
{
|
||||
public IDictionary<string, object> Values { get; private set; }
|
||||
|
||||
public bool Match(
|
||||
HttpContext httpContext,
|
||||
IRouter route,
|
||||
string routeKey,
|
||||
RouteValueDictionary values,
|
||||
RouteDirection routeDirection)
|
||||
{
|
||||
Values = new RouteValueDictionary(values);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue