React to Cors api review changes
This commit is contained in:
parent
fd17481a73
commit
fbf66168fe
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
using Microsoft.AspNet.Cors.Infrastructure;
|
||||||
using Microsoft.AspNet.Mvc.ApplicationModels;
|
using Microsoft.AspNet.Mvc.ApplicationModels;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.Cors
|
namespace Microsoft.AspNet.Mvc.Cors
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
using Microsoft.AspNet.Cors.Infrastructure;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Mvc.Filters;
|
using Microsoft.AspNet.Mvc.Filters;
|
||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
|
|
@ -98,7 +98,7 @@ namespace Microsoft.AspNet.Mvc.Cors
|
||||||
private bool IsClosestToAction(IEnumerable<IFilterMetadata> filters)
|
private bool IsClosestToAction(IEnumerable<IFilterMetadata> filters)
|
||||||
{
|
{
|
||||||
// If there are multiple ICorsAuthorizationFilter which are defined at the class and
|
// 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),
|
// 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.
|
// we apply this constraint only if there is no ICorsAuthorizationFilter after this.
|
||||||
return filters.Last(filter => filter is ICorsAuthorizationFilter) == this;
|
return filters.Last(filter => filter is ICorsAuthorizationFilter) == this;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
using Microsoft.AspNet.Cors.Infrastructure;
|
||||||
using Microsoft.AspNet.Mvc.ApplicationModels;
|
using Microsoft.AspNet.Mvc.ApplicationModels;
|
||||||
using Microsoft.AspNet.Mvc.Cors;
|
using Microsoft.AspNet.Mvc.Cors;
|
||||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
using Microsoft.AspNet.Cors.Infrastructure;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Mvc.Filters;
|
using Microsoft.AspNet.Mvc.Filters;
|
||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
"warningsAsErrors": true
|
"warningsAsErrors": true
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.Cors.Core": "6.0.0-*",
|
"Microsoft.AspNet.Cors": "6.0.0-*",
|
||||||
"Microsoft.AspNet.Mvc.Core": "6.0.0-*"
|
"Microsoft.AspNet.Mvc.Core": "6.0.0-*"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
using Microsoft.AspNet.Cors;
|
||||||
using Microsoft.AspNet.Mvc.ApplicationModels;
|
using Microsoft.AspNet.Mvc.ApplicationModels;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
using Microsoft.AspNet.Cors.Infrastructure;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Http.Internal;
|
using Microsoft.AspNet.Http.Internal;
|
||||||
using Microsoft.AspNet.Mvc.Abstractions;
|
using Microsoft.AspNet.Mvc.Abstractions;
|
||||||
|
|
@ -93,7 +93,7 @@ namespace Microsoft.AspNet.Mvc.Cors
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task CorsRequest_FailedMatch_Writes200()
|
public async Task CorsRequest_FailedMatch_Writes200()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var mockEngine = GetFailingEngine();
|
var mockEngine = GetFailingEngine();
|
||||||
var filter = GetFilter(mockEngine);
|
var filter = GetFilter(mockEngine);
|
||||||
|
|
@ -129,7 +129,7 @@ namespace Microsoft.AspNet.Mvc.Cors
|
||||||
RequestHeaders headers = null,
|
RequestHeaders headers = null,
|
||||||
bool isPreflight = false)
|
bool isPreflight = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
// HttpContext
|
// HttpContext
|
||||||
var httpContext = new DefaultHttpContext();
|
var httpContext = new DefaultHttpContext();
|
||||||
if (headers != null)
|
if (headers != null)
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Cors.Infrastructure;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.FunctionalTests
|
namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
using Microsoft.AspNet.Cors.Infrastructure;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.FunctionalTests
|
namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
using Microsoft.AspNet.Cors;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
|
|
||||||
namespace CorsWebSite
|
namespace CorsWebSite
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// 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.Builder;
|
||||||
using Microsoft.AspNet.Cors.Core;
|
using Microsoft.AspNet.Cors.Infrastructure;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace CorsWebSite
|
namespace CorsWebSite
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
|
"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": "6.0.0-*",
|
||||||
"Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*",
|
"Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*",
|
||||||
"Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0",
|
"Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue