-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parameterless overload for RequireCors
API
#46922
Comments
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
Thanks for contacting us. We're moving this issue to the |
API Review Notes:
API Approved! namespace Microsoft.AspNetCore.Builder;
public static class CorsEndpointConventionBuilderExtensions
{
+ public static TBuilder RequireCors<TBuilder>(this TBuilder builder) where TBuilder : IEndpointConventionBuilder
} |
Background and Motivation
The
RequireCors
extension method is an imperative style API designed to be used in conjunction with endpoints as an alternative to theEnableCors
attribute.At the moment, the
RequireCors
method provides two overloads:At the moment, there is no way to invoke
RequireCors
with the default behavior that is available in theEnableCors
attribute as mentioned here since the invocation would be ambiguous between the two overloads:Proposed API
namespace Microsoft.AspNetCore.Builder; public static class CorsEndpointConventionBuilderExtensions { + public static TBuilder RequireCors<TBuilder>(this TBuilder builder) where TBuilder : IEndpointConventionBuilder }
Usage Examples
Alternative Designs
EnableCors
attributes on endpoints to get the desired behaviorThe text was updated successfully, but these errors were encountered: