Fixing CORS attribute - #544
Conversation
Registering selectors with CORS when controller/action use CORS attributes. Fixes OData#534.
|
Hi @marabooy check this out |
|
|
||
|
|
||
| // Check if CORS attribute is specified on action. New selectors need to be registered with CORS support. | ||
| bool acceptPreflight = action.Controller.Attributes.OfType<IDisableCorsAttribute>().Any() || |
There was a problem hiding this comment.
@giulianob Based on this statement, how does a controller action with neither EnableCors nor DisableCors return a value of true for AcceptCorsPreflight of HttpMethodMetadata instance?
RE: https://github.com/OData/AspNetCoreOData/pull/544/files#diff-b4918c8cb621def5a0806e8f4e36a80bf254f78da5f1bb2b27f2eb9a1afd1de7R123
There was a problem hiding this comment.
@gathogojr the Get action in the tests does have an [EnableCors] attribute, see: https://github.com/OData/AspNetCoreOData/pull/544/files#diff-b4918c8cb621def5a0806e8f4e36a80bf254f78da5f1bb2b27f2eb9a1afd1de7R152
What doesn't have the attribute is the TestController.Index action. And for that one, the expected result is false.
Registering selectors with CORS when controller/action use CORS attributes. Fixes #534.