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
This commit is contained in:
parent
da984f57c5
commit
5f169dce14
|
|
@ -98,7 +98,7 @@ namespace Microsoft.AspNetCore.Routing
|
||||||
throw new InvalidOperationException($"Endpoint {endpoint.DisplayName} contains CORS metadata, " +
|
throw new InvalidOperationException($"Endpoint {endpoint.DisplayName} contains CORS metadata, " +
|
||||||
"but a middleware was not found that supports CORS." +
|
"but a middleware was not found that supports CORS." +
|
||||||
Environment.NewLine +
|
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
|
private static class Log
|
||||||
|
|
|
||||||
|
|
@ -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." +
|
private static readonly string CORSErrorMessage = "Endpoint / contains CORS metadata, but a middleware was not found that supports CORS." +
|
||||||
Environment.NewLine +
|
Environment.NewLine +
|
||||||
"Configure your application startup by adding app.UseCors() inside the call to Configure(..) in the application startup code. " +
|
"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]
|
[Fact]
|
||||||
public async Task AuthorizationMiddleware_WhenNoAuthMetadataIsConfigured()
|
public async Task AuthorizationMiddleware_WhenNoAuthMetadataIsConfigured()
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ namespace Microsoft.AspNetCore.Routing
|
||||||
var expected = "Endpoint Test contains CORS metadata, but a middleware was not found that supports CORS." +
|
var expected = "Endpoint Test contains CORS metadata, but a middleware was not found that supports CORS." +
|
||||||
Environment.NewLine +
|
Environment.NewLine +
|
||||||
"Configure your application startup by adding app.UseCors() inside the call to Configure(..) in the application startup code. " +
|
"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
|
var httpContext = new DefaultHttpContext
|
||||||
{
|
{
|
||||||
RequestServices = new ServiceProvider()
|
RequestServices = new ServiceProvider()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue