[Fixes #2743] Removed ErrorReporterMiddleware in some places
This commit is contained in:
parent
3d8225502f
commit
43eb621d19
|
|
@ -7,6 +7,7 @@ using System.Net;
|
|||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FiltersWebSite;
|
||||
using Microsoft.AspNet.Mvc.Formatters.Xml;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
|||
|
|
@ -822,24 +822,6 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
Assert.Equal("Departments", result.RouteName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("http://localhost/Duplicate/Index")]
|
||||
[InlineData("http://localhost/api/Duplicate/IndexAttribute")]
|
||||
[InlineData("http://localhost/api/Duplicate")]
|
||||
[InlineData("http://localhost/conventional/Duplicate")]
|
||||
public async Task AttributeRoutedAction_ThowsIfConventionalRouteWithTheSameName(string url)
|
||||
{
|
||||
// Arrange
|
||||
var expectedMessage = "The supplied route name 'DuplicateRoute' is ambiguous and matched more than one route.";
|
||||
|
||||
// Act
|
||||
var response = await Client.GetAsync(url);
|
||||
|
||||
// Assert
|
||||
var exception = response.GetServerException();
|
||||
Assert.Equal(expectedMessage, exception.ExceptionMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ConventionalRoutedAction_LinkToArea()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc.Infrastructure;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -483,22 +482,6 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
Assert.Equal(expectedActionName, result.ActionName);
|
||||
}
|
||||
|
||||
// This would result in ambiguous match because complex parameter is not considered for matching.
|
||||
// Therefore, PostUserByNameAndAddress(string name, Address address) would conflicts with PostUserByName(string name)
|
||||
[Fact]
|
||||
public async Task LegacyActionSelection_RequestToAmbiguousAction_OnDefaultRoute()
|
||||
{
|
||||
// Arrange
|
||||
var request = new HttpRequestMessage(new HttpMethod("POST"), "http://localhost/api/Admin/Test?name=mario");
|
||||
|
||||
// Act
|
||||
var response = await Client.SendAsync(request);
|
||||
|
||||
// Assert
|
||||
var exception = response.GetServerException();
|
||||
Assert.Equal(typeof(AmbiguousActionException).FullName, exception.ExceptionType);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("GET", "api/Admin/EnumParameterOverloads", "Get")]
|
||||
[InlineData("GET", "api/Admin/EnumParameterOverloads?scope=global", "GetWithEnumParameter")]
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@
|
|||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Http;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.TestConfiguration
|
||||
namespace FiltersWebSite
|
||||
{
|
||||
/// <summary>
|
||||
/// A middleware that reports errors via header values. Useful for tests that want to verify
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||
namespace FiltersWebSite
|
||||
{
|
||||
/// <summary>
|
||||
/// Information about an exception that occurred on the server side of a functional
|
||||
|
|
@ -4,11 +4,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNet.Mvc.TestConfiguration;
|
||||
using Xunit;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||
namespace FiltersWebSite
|
||||
{
|
||||
public static class HttpResponseMessageExceptions
|
||||
{
|
||||
|
|
@ -58,10 +58,10 @@ namespace FiltersWebSite
|
|||
{
|
||||
app.UseCultureReplacer();
|
||||
|
||||
app.UseErrorReporter();
|
||||
|
||||
app.UseMiddleware<AuthorizeBasicMiddleware>("Interactive");
|
||||
app.UseMiddleware<AuthorizeBasicMiddleware>("Api");
|
||||
app.UseMiddleware<ErrorReporterMiddleware>();
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,5 @@ namespace Microsoft.AspNet.Builder
|
|||
{
|
||||
return app.UseMiddleware<CultureReplacerMiddleware>();
|
||||
}
|
||||
|
||||
public static IApplicationBuilder UseErrorReporter(this IApplicationBuilder app)
|
||||
{
|
||||
return app.UseMiddleware<ErrorReporterMiddleware>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
// 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 Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace RoutingWebSite
|
||||
{
|
||||
public class DuplicateController : Controller
|
||||
{
|
||||
private readonly TestResponseGenerator _generator;
|
||||
|
||||
public DuplicateController(TestResponseGenerator generator)
|
||||
{
|
||||
_generator = generator;
|
||||
}
|
||||
|
||||
[HttpGet("api/Duplicate/", Name = "DuplicateRoute")]
|
||||
public ActionResult DuplicateAttribute()
|
||||
{
|
||||
return _generator.Generate(Url.RouteUrl("DuplicateRoute"));
|
||||
}
|
||||
|
||||
[HttpGet("api/Duplicate/IndexAttribute")]
|
||||
public ActionResult IndexAttribute()
|
||||
{
|
||||
return _generator.Generate(Url.RouteUrl("DuplicateRoute"));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Duplicate()
|
||||
{
|
||||
return _generator.Generate(Url.RouteUrl("DuplicateRoute"));
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return _generator.Generate(Url.RouteUrl("DuplicateRoute"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,8 +22,6 @@ namespace RoutingWebSite
|
|||
{
|
||||
app.UseCultureReplacer();
|
||||
|
||||
app.UseErrorReporter();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
|
|
@ -36,15 +34,6 @@ namespace RoutingWebSite
|
|||
"{controller}/{action}",
|
||||
defaults: new { controller = "Home", action = "Index" });
|
||||
|
||||
// Added this route to validate that we throw an exception when a conventional
|
||||
// route matches a link generated by a named attribute route.
|
||||
// The conventional route will match first, but when the attribute route generates
|
||||
// a valid route an exception will be thrown.
|
||||
routes.MapRoute(
|
||||
"DuplicateRoute",
|
||||
"conventional/Duplicate",
|
||||
defaults: new { controller = "Duplicate", action = "Duplicate" });
|
||||
|
||||
routes.MapRoute(
|
||||
"RouteWithOptionalSegment",
|
||||
"{controller}/{action}/{path?}");
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ namespace WebApiCompatShimWebSite
|
|||
{
|
||||
app.UseCultureReplacer();
|
||||
|
||||
app.UseErrorReporter();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
// Tests include different styles of WebAPI conventional routing and action selection - the prefix keeps
|
||||
|
|
|
|||
|
|
@ -68,8 +68,6 @@ namespace XmlFormattersWebSite
|
|||
{
|
||||
app.UseCultureReplacer();
|
||||
|
||||
app.UseErrorReporter();
|
||||
|
||||
// Add MVC to the request pipeline
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue