8 changed files with 173 additions and 140 deletions
@ -0,0 +1,15 @@
|
||||
using Microsoft.AspNetCore.Cors.Infrastructure; |
||||
using Sanhe.Abp.Wrapper; |
||||
|
||||
namespace Microsoft.AspNetCore.Cors; |
||||
|
||||
public static class AbpCorsPolicyBuilderExtensions |
||||
{ |
||||
public static CorsPolicyBuilder WithAbpWrapExposedHeaders(this CorsPolicyBuilder corsPolicyBuilder) |
||||
{ |
||||
return corsPolicyBuilder |
||||
.WithExposedHeaders( |
||||
AbpHttpWrapConsts.AbpWrapResult, |
||||
AbpHttpWrapConsts.AbpDontWrapResult); |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
using Microsoft.AspNetCore.Mvc.Abstractions; |
||||
using Microsoft.AspNetCore.Mvc.Controllers; |
||||
using Sanhe.Abp.Wrapper; |
||||
|
||||
namespace Microsoft.AspNetCore.Mvc; |
||||
|
||||
public static class ActionContextExtensions |
||||
{ |
||||
public static bool CanWarpRsult(this ActionDescriptor actionDescriptor) |
||||
{ |
||||
if (actionDescriptor is ControllerActionDescriptor descriptor) |
||||
{ |
||||
if (descriptor.MethodInfo.IsDefined(typeof(IgnoreWrapResultAttribute), true)) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
if (descriptor.ControllerTypeInfo.IsDefined(typeof(IgnoreWrapResultAttribute), true)) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
} |
Loading…
Reference in new issue