From fbf66168feabb8b3601b96432b0c97cbc51c76db Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Thu, 8 Oct 2015 13:48:51 -0700 Subject: [PATCH] React to Cors api review changes --- .../CorsApplicationModelProvider.cs | 2 +- src/Microsoft.AspNet.Mvc.Cors/CorsAuthorizationFilter.cs | 4 ++-- .../DependencyInjection/MvcCorsMvcCoreBuilderExtensions.cs | 2 +- .../DisableCorsAuthorizationFilter.cs | 2 +- src/Microsoft.AspNet.Mvc.Cors/project.json | 2 +- .../CorsApplicationModelProviderTest.cs | 2 +- .../CorsAuthorizationFilterTest.cs | 6 +++--- .../CorsMiddlewareTests.cs | 5 +---- test/Microsoft.AspNet.Mvc.FunctionalTests/CorsTests.cs | 2 +- test/WebSites/CorsWebSite/Controllers/BlogController.cs | 2 +- test/WebSites/CorsWebSite/Startup.cs | 2 +- test/WebSites/CorsWebSite/project.json | 2 +- 12 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/Microsoft.AspNet.Mvc.Cors/CorsApplicationModelProvider.cs b/src/Microsoft.AspNet.Mvc.Cors/CorsApplicationModelProvider.cs index 2b2ab5dab5..f189c34964 100644 --- a/src/Microsoft.AspNet.Mvc.Cors/CorsApplicationModelProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Cors/CorsApplicationModelProvider.cs @@ -3,7 +3,7 @@ using System; using System.Linq; -using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Cors.Infrastructure; using Microsoft.AspNet.Mvc.ApplicationModels; namespace Microsoft.AspNet.Mvc.Cors diff --git a/src/Microsoft.AspNet.Mvc.Cors/CorsAuthorizationFilter.cs b/src/Microsoft.AspNet.Mvc.Cors/CorsAuthorizationFilter.cs index 04d80c73c7..52c1f4c9ad 100644 --- a/src/Microsoft.AspNet.Mvc.Cors/CorsAuthorizationFilter.cs +++ b/src/Microsoft.AspNet.Mvc.Cors/CorsAuthorizationFilter.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Cors.Infrastructure; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc.Filters; using Microsoft.Extensions.Primitives; @@ -98,7 +98,7 @@ namespace Microsoft.AspNet.Mvc.Cors private bool IsClosestToAction(IEnumerable filters) { // If there are multiple ICorsAuthorizationFilter which are defined at the class and - // at the action level, the one closest to the action overrides the others. + // at the action level, the one closest to the action overrides the others. // Since filterdescriptor collection is ordered (the last filter is the one closest to the action), // we apply this constraint only if there is no ICorsAuthorizationFilter after this. return filters.Last(filter => filter is ICorsAuthorizationFilter) == this; diff --git a/src/Microsoft.AspNet.Mvc.Cors/DependencyInjection/MvcCorsMvcCoreBuilderExtensions.cs b/src/Microsoft.AspNet.Mvc.Cors/DependencyInjection/MvcCorsMvcCoreBuilderExtensions.cs index e08e45107a..27c549a418 100644 --- a/src/Microsoft.AspNet.Mvc.Cors/DependencyInjection/MvcCorsMvcCoreBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Mvc.Cors/DependencyInjection/MvcCorsMvcCoreBuilderExtensions.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Cors.Infrastructure; using Microsoft.AspNet.Mvc.ApplicationModels; using Microsoft.AspNet.Mvc.Cors; using Microsoft.Extensions.DependencyInjection.Extensions; diff --git a/src/Microsoft.AspNet.Mvc.Cors/DisableCorsAuthorizationFilter.cs b/src/Microsoft.AspNet.Mvc.Cors/DisableCorsAuthorizationFilter.cs index fdc38796e3..fcf55ea402 100644 --- a/src/Microsoft.AspNet.Mvc.Cors/DisableCorsAuthorizationFilter.cs +++ b/src/Microsoft.AspNet.Mvc.Cors/DisableCorsAuthorizationFilter.cs @@ -3,7 +3,7 @@ using System; using System.Threading.Tasks; -using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Cors.Infrastructure; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc.Filters; using Microsoft.Extensions.Primitives; diff --git a/src/Microsoft.AspNet.Mvc.Cors/project.json b/src/Microsoft.AspNet.Mvc.Cors/project.json index c9a76e9375..36c8efd5d4 100644 --- a/src/Microsoft.AspNet.Mvc.Cors/project.json +++ b/src/Microsoft.AspNet.Mvc.Cors/project.json @@ -9,7 +9,7 @@ "warningsAsErrors": true }, "dependencies": { - "Microsoft.AspNet.Cors.Core": "6.0.0-*", + "Microsoft.AspNet.Cors": "6.0.0-*", "Microsoft.AspNet.Mvc.Core": "6.0.0-*" }, diff --git a/test/Microsoft.AspNet.Mvc.Cors.Test/CorsApplicationModelProviderTest.cs b/test/Microsoft.AspNet.Mvc.Cors.Test/CorsApplicationModelProviderTest.cs index 0660db93ea..c5b9157f43 100644 --- a/test/Microsoft.AspNet.Mvc.Cors.Test/CorsApplicationModelProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.Cors.Test/CorsApplicationModelProviderTest.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Reflection; -using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Cors; using Microsoft.AspNet.Mvc.ApplicationModels; using Xunit; diff --git a/test/Microsoft.AspNet.Mvc.Cors.Test/CorsAuthorizationFilterTest.cs b/test/Microsoft.AspNet.Mvc.Cors.Test/CorsAuthorizationFilterTest.cs index fa066a3595..d0bb398bd3 100644 --- a/test/Microsoft.AspNet.Mvc.Cors.Test/CorsAuthorizationFilterTest.cs +++ b/test/Microsoft.AspNet.Mvc.Cors.Test/CorsAuthorizationFilterTest.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Cors.Infrastructure; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.Abstractions; @@ -93,7 +93,7 @@ namespace Microsoft.AspNet.Mvc.Cors [Fact] public async Task CorsRequest_FailedMatch_Writes200() - { + { // Arrange var mockEngine = GetFailingEngine(); var filter = GetFilter(mockEngine); @@ -129,7 +129,7 @@ namespace Microsoft.AspNet.Mvc.Cors RequestHeaders headers = null, bool isPreflight = false) { - + // HttpContext var httpContext = new DefaultHttpContext(); if (headers != null) diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsMiddlewareTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsMiddlewareTests.cs index 2d33a9d016..4f9747f4c7 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsMiddlewareTests.cs @@ -1,14 +1,11 @@ // 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 System; using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Cors.Core; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNet.Cors.Infrastructure; using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsTests.cs index e9979f9c74..4d45fa9164 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsTests.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/CorsTests.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Cors.Infrastructure; using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests diff --git a/test/WebSites/CorsWebSite/Controllers/BlogController.cs b/test/WebSites/CorsWebSite/Controllers/BlogController.cs index 332d166735..5dd901dc95 100644 --- a/test/WebSites/CorsWebSite/Controllers/BlogController.cs +++ b/test/WebSites/CorsWebSite/Controllers/BlogController.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Cors; using Microsoft.AspNet.Mvc; namespace CorsWebSite diff --git a/test/WebSites/CorsWebSite/Startup.cs b/test/WebSites/CorsWebSite/Startup.cs index a371191966..8fb686f5da 100644 --- a/test/WebSites/CorsWebSite/Startup.cs +++ b/test/WebSites/CorsWebSite/Startup.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Cors.Infrastructure; using Microsoft.Extensions.DependencyInjection; namespace CorsWebSite diff --git a/test/WebSites/CorsWebSite/project.json b/test/WebSites/CorsWebSite/project.json index 1163d435af..c713e9238e 100644 --- a/test/WebSites/CorsWebSite/project.json +++ b/test/WebSites/CorsWebSite/project.json @@ -5,7 +5,7 @@ }, "dependencies": { "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Cors.Core": "6.0.0-*", + "Microsoft.AspNet.Cors": "6.0.0-*", "Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*", "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0",