CR feedback
This commit is contained in:
parent
d2a3bd3490
commit
f43985b58d
|
|
@ -11,7 +11,7 @@ namespace RoutingSample
|
||||||
{
|
{
|
||||||
if (routes.DefaultHandler == null)
|
if (routes.DefaultHandler == null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("DefaultHandler must be set.");
|
throw new ArgumentException("DefaultHandler must be set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return AddPrefixRoute(routes, prefix, routes.DefaultHandler);
|
return AddPrefixRoute(routes, prefix, routes.DefaultHandler);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#if NET45
|
#if NET45
|
||||||
|
|
||||||
using Microsoft.AspNet.Abstractions;
|
using Microsoft.AspNet.Abstractions;
|
||||||
using Microsoft.AspNet.Routing.Template;
|
using Microsoft.AspNet.Routing;
|
||||||
using Owin;
|
using Owin;
|
||||||
|
|
||||||
namespace RoutingSample
|
namespace RoutingSample
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNet.Routing.Template;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Routing.Template
|
namespace Microsoft.AspNet.Routing
|
||||||
{
|
{
|
||||||
public static class RouteCollectionExtensions
|
public static class RouteCollectionExtensions
|
||||||
{
|
{
|
||||||
|
|
@ -23,7 +24,7 @@ namespace Microsoft.AspNet.Routing.Template
|
||||||
{
|
{
|
||||||
if (routes.DefaultHandler == null)
|
if (routes.DefaultHandler == null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("DefaultHandler must be set.");
|
throw new ArgumentException("DefaultHandler must be set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
routes.Add(new TemplateRoute(routes.DefaultHandler, template, defaults));
|
routes.Add(new TemplateRoute(routes.DefaultHandler, template, defaults));
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Abstractions;
|
using Microsoft.AspNet.Abstractions;
|
||||||
|
|
||||||
|
|
@ -76,20 +77,25 @@ namespace Microsoft.AspNet.Routing.Template
|
||||||
|
|
||||||
public void BindPath(BindPathContext context)
|
public void BindPath(BindPathContext context)
|
||||||
{
|
{
|
||||||
// This could be optimized more heavily - right now we try to do the full url
|
// Validate that the target can accept these values.
|
||||||
// generation before validating, but we could do it in two phases.
|
_target.BindPath(context);
|
||||||
var path = _binder.Bind(_defaults, context.AmbientValues, context.Values);
|
if (!context.IsBound)
|
||||||
if (path == null)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.BoundPath = path;
|
// This could be optimized more heavily - right now we try to do the full url
|
||||||
_target.BindPath(context);
|
// generation after validating, but we could do it in two phases.
|
||||||
|
var path = _binder.Bind(_defaults, context.AmbientValues, context.Values);
|
||||||
if (!context.IsBound)
|
if (path == null)
|
||||||
{
|
{
|
||||||
context.BoundPath = null;
|
context.IsBound = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Assert(context.IsBound);
|
||||||
|
context.BoundPath = path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ namespace Microsoft.AspNet.Routing.Template.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void Match_RejectedByHanlder()
|
public async void Match_RejectedByHandler()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var route = CreateRoute("{controller}", accept: false);
|
var route = CreateRoute("{controller}", accept: false);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue