Reacting to hosting rename
This commit is contained in:
Родитель
1d572c11de
Коммит
7ab5f67708
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Cors.Infrastructure
|
||||||
public async Task CorsRequest_MatchPolicy_SetsResponseHeaders()
|
public async Task CorsRequest_MatchPolicy_SetsResponseHeaders()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var appBuilder = new WebApplicationBuilder()
|
var hostBuilder = new WebHostBuilder()
|
||||||
.Configure(app =>
|
.Configure(app =>
|
||||||
{
|
{
|
||||||
app.UseCors(builder =>
|
app.UseCors(builder =>
|
||||||
|
@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Cors.Infrastructure
|
||||||
})
|
})
|
||||||
.ConfigureServices(services => services.AddCors());
|
.ConfigureServices(services => services.AddCors());
|
||||||
|
|
||||||
using (var server = new TestServer(appBuilder))
|
using (var server = new TestServer(hostBuilder))
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
// Actual request.
|
// Actual request.
|
||||||
|
@ -63,7 +63,7 @@ namespace Microsoft.AspNet.Cors.Infrastructure
|
||||||
policy.Headers.Add("Header1");
|
policy.Headers.Add("Header1");
|
||||||
policy.ExposedHeaders.Add("AllowedHeader");
|
policy.ExposedHeaders.Add("AllowedHeader");
|
||||||
|
|
||||||
var appBuilder = new WebApplicationBuilder()
|
var hostBuilder = new WebHostBuilder()
|
||||||
.Configure(app =>
|
.Configure(app =>
|
||||||
{
|
{
|
||||||
app.UseCors("customPolicy");
|
app.UseCors("customPolicy");
|
||||||
|
@ -80,7 +80,7 @@ namespace Microsoft.AspNet.Cors.Infrastructure
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
using (var server = new TestServer(appBuilder))
|
using (var server = new TestServer(hostBuilder))
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
// Preflight request.
|
// Preflight request.
|
||||||
|
@ -101,7 +101,7 @@ namespace Microsoft.AspNet.Cors.Infrastructure
|
||||||
public async Task PreFlightRequest_DoesNotMatchPolicy_DoesNotSetHeaders()
|
public async Task PreFlightRequest_DoesNotMatchPolicy_DoesNotSetHeaders()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var appBuilder = new WebApplicationBuilder()
|
var hostBuilder = new WebHostBuilder()
|
||||||
.Configure(app =>
|
.Configure(app =>
|
||||||
{
|
{
|
||||||
app.UseCors(builder =>
|
app.UseCors(builder =>
|
||||||
|
@ -116,7 +116,7 @@ namespace Microsoft.AspNet.Cors.Infrastructure
|
||||||
})
|
})
|
||||||
.ConfigureServices(services => services.AddCors());
|
.ConfigureServices(services => services.AddCors());
|
||||||
|
|
||||||
using (var server = new TestServer(appBuilder))
|
using (var server = new TestServer(hostBuilder))
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
// Preflight request.
|
// Preflight request.
|
||||||
|
@ -135,7 +135,7 @@ namespace Microsoft.AspNet.Cors.Infrastructure
|
||||||
public async Task CorsRequest_DoesNotMatchPolicy_DoesNotSetHeaders()
|
public async Task CorsRequest_DoesNotMatchPolicy_DoesNotSetHeaders()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var appBuilder = new WebApplicationBuilder()
|
var hostBuilder = new WebHostBuilder()
|
||||||
.Configure(app =>
|
.Configure(app =>
|
||||||
{
|
{
|
||||||
app.UseCors(builder =>
|
app.UseCors(builder =>
|
||||||
|
@ -150,7 +150,7 @@ namespace Microsoft.AspNet.Cors.Infrastructure
|
||||||
})
|
})
|
||||||
.ConfigureServices(services => services.AddCors());
|
.ConfigureServices(services => services.AddCors());
|
||||||
|
|
||||||
using (var server = new TestServer(appBuilder))
|
using (var server = new TestServer(hostBuilder))
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
// Actual request.
|
// Actual request.
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Cors.Infrastructure
|
||||||
|
|
||||||
public CorsTestFixture()
|
public CorsTestFixture()
|
||||||
{
|
{
|
||||||
var builder = new WebApplicationBuilder().UseStartup<TStartup>();
|
var builder = new WebHostBuilder().UseStartup<TStartup>();
|
||||||
_server = new TestServer(builder);
|
_server = new TestServer(builder);
|
||||||
|
|
||||||
Client = _server.CreateClient();
|
Client = _server.CreateClient();
|
||||||
|
|
|
@ -21,13 +21,13 @@ namespace CorsMiddlewareWebSite
|
||||||
}
|
}
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var application = new WebApplicationBuilder()
|
var host = new WebHostBuilder()
|
||||||
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
|
.UseDefaultConfiguration(args)
|
||||||
.UseIISPlatformHandlerUrl()
|
.UseIISPlatformHandlerUrl()
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
application.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Загрузка…
Ссылка в новой задаче