React to hosting

This commit is contained in:
Hao Kung 2015-03-19 11:20:23 -07:00
parent 55af12b620
commit 7fe9aceb19
2 changed files with 15 additions and 15 deletions

View File

@ -2,7 +2,7 @@
"version": "1.0.0-*", "version": "1.0.0-*",
"dependencies": { "dependencies": {
"Microsoft.AspNet.Cors.Core": "1.0.0-*", "Microsoft.AspNet.Cors.Core": "1.0.0-*",
"Microsoft.AspNet.RequestContainer": "1.0.0-*", "Microsoft.AspNet.Hosting": "1.0.0-*",
"Microsoft.AspNet.WebUtilities": "1.0.0-*", "Microsoft.AspNet.WebUtilities": "1.0.0-*",
"Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" } "Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" }
}, },

View File

@ -23,7 +23,6 @@ namespace Microsoft.AspNet.Cors.Test
// Arrange // Arrange
using (var server = TestServer.Create(app => using (var server = TestServer.Create(app =>
{ {
app.UseServices(services => services.AddCors());
app.UseCors(builder => app.UseCors(builder =>
builder.WithOrigins("http://localhost:5001") builder.WithOrigins("http://localhost:5001")
.WithMethods("PUT") .WithMethods("PUT")
@ -33,7 +32,8 @@ namespace Microsoft.AspNet.Cors.Test
{ {
await context.Response.WriteAsync("Cross origin response"); await context.Response.WriteAsync("Cross origin response");
}); });
})) },
services => services.AddCors()))
{ {
// Act // Act
// Actual request. // Actual request.
@ -62,19 +62,19 @@ namespace Microsoft.AspNet.Cors.Test
using (var server = TestServer.Create(app => using (var server = TestServer.Create(app =>
{ {
app.UseServices(services =>
{
services.AddCors();
services.ConfigureCors(options =>
{
options.AddPolicy("customPolicy", policy);
});
});
app.UseCors("customPolicy"); app.UseCors("customPolicy");
app.Run(async context => app.Run(async context =>
{ {
await context.Response.WriteAsync("Cross origin response"); await context.Response.WriteAsync("Cross origin response");
}); });
},
services =>
{
services.AddCors();
services.ConfigureCors(options =>
{
options.AddPolicy("customPolicy", policy);
});
})) }))
{ {
// Act // Act
@ -98,7 +98,6 @@ namespace Microsoft.AspNet.Cors.Test
// Arrange // Arrange
using (var server = TestServer.Create(app => using (var server = TestServer.Create(app =>
{ {
app.UseServices(services => services.AddCors());
app.UseCors(builder => app.UseCors(builder =>
builder.WithOrigins("http://localhost:5001") builder.WithOrigins("http://localhost:5001")
.WithMethods("PUT") .WithMethods("PUT")
@ -108,7 +107,8 @@ namespace Microsoft.AspNet.Cors.Test
{ {
await context.Response.WriteAsync("Cross origin response"); await context.Response.WriteAsync("Cross origin response");
}); });
})) },
services => services.AddCors()))
{ {
// Act // Act
// Preflight request. // Preflight request.
@ -129,7 +129,6 @@ namespace Microsoft.AspNet.Cors.Test
// Arrange // Arrange
using (var server = TestServer.Create(app => using (var server = TestServer.Create(app =>
{ {
app.UseServices(services => services.AddCors());
app.UseCors(builder => app.UseCors(builder =>
builder.WithOrigins("http://localhost:5001") builder.WithOrigins("http://localhost:5001")
.WithMethods("PUT") .WithMethods("PUT")
@ -139,7 +138,8 @@ namespace Microsoft.AspNet.Cors.Test
{ {
await context.Response.WriteAsync("Cross origin response"); await context.Response.WriteAsync("Cross origin response");
}); });
})) },
services => services.AddCors()))
{ {
// Act // Act
// Actual request. // Actual request.