From 5f169dce1446693de1cd8d823a94665dd2d81040 Mon Sep 17 00:00:00 2001 From: Kahbazi Date: Fri, 10 Jan 2020 01:56:37 +0330 Subject: [PATCH] Fix missing cors middleware exception message (#17892) * Fix missing cors middleware exception message * Update unit test expected error message * Update integration test expected error message --- src/Http/Routing/src/EndpointMiddleware.cs | 2 +- .../test/FunctionalTests/EndpointRoutingIntegrationTest.cs | 2 +- src/Http/Routing/test/UnitTests/EndpointMiddlewareTest.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Http/Routing/src/EndpointMiddleware.cs b/src/Http/Routing/src/EndpointMiddleware.cs index 9b06b673ad..0e11e560b7 100644 --- a/src/Http/Routing/src/EndpointMiddleware.cs +++ b/src/Http/Routing/src/EndpointMiddleware.cs @@ -98,7 +98,7 @@ namespace Microsoft.AspNetCore.Routing throw new InvalidOperationException($"Endpoint {endpoint.DisplayName} contains CORS metadata, " + "but a middleware was not found that supports CORS." + Environment.NewLine + - "Configure your application startup by adding app.UseCors() inside the call to Configure(..) in the application startup code. The call to app.UseAuthorization() must appear between app.UseRouting() and app.UseEndpoints(...)."); + "Configure your application startup by adding app.UseCors() inside the call to Configure(..) in the application startup code. The call to app.UseCors() must appear between app.UseRouting() and app.UseEndpoints(...)."); } private static class Log diff --git a/src/Http/Routing/test/FunctionalTests/EndpointRoutingIntegrationTest.cs b/src/Http/Routing/test/FunctionalTests/EndpointRoutingIntegrationTest.cs index 232d648714..f0fa4a4f59 100644 --- a/src/Http/Routing/test/FunctionalTests/EndpointRoutingIntegrationTest.cs +++ b/src/Http/Routing/test/FunctionalTests/EndpointRoutingIntegrationTest.cs @@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Routing.FunctionalTests private static readonly string CORSErrorMessage = "Endpoint / contains CORS metadata, but a middleware was not found that supports CORS." + Environment.NewLine + "Configure your application startup by adding app.UseCors() inside the call to Configure(..) in the application startup code. " + - "The call to app.UseAuthorization() must appear between app.UseRouting() and app.UseEndpoints(...)."; + "The call to app.UseCors() must appear between app.UseRouting() and app.UseEndpoints(...)."; [Fact] public async Task AuthorizationMiddleware_WhenNoAuthMetadataIsConfigured() diff --git a/src/Http/Routing/test/UnitTests/EndpointMiddlewareTest.cs b/src/Http/Routing/test/UnitTests/EndpointMiddlewareTest.cs index 7a638e7e8c..75ddf41453 100644 --- a/src/Http/Routing/test/UnitTests/EndpointMiddlewareTest.cs +++ b/src/Http/Routing/test/UnitTests/EndpointMiddlewareTest.cs @@ -199,7 +199,7 @@ namespace Microsoft.AspNetCore.Routing var expected = "Endpoint Test contains CORS metadata, but a middleware was not found that supports CORS." + Environment.NewLine + "Configure your application startup by adding app.UseCors() inside the call to Configure(..) in the application startup code. " + - "The call to app.UseAuthorization() must appear between app.UseRouting() and app.UseEndpoints(...)."; + "The call to app.UseCors() must appear between app.UseRouting() and app.UseEndpoints(...)."; var httpContext = new DefaultHttpContext { RequestServices = new ServiceProvider()