using System; using EmbedIO.Cors; using EmbedIO.Utilities; using Swan; namespace EmbedIO { partial class WebModuleContainerExtensions { /// /// Creates an instance of and adds it to a module container. /// /// The type of the module container. /// The on which this method is called. /// The base route of the module. /// The valid origins. Default is "*", meaning all origins. /// The valid headers. Default is "*", meaning all headers. /// The valid method. Default is "*", meaning all methods. /// with a added. /// is . /// public static TContainer WithCors( this TContainer @this, string baseRoute, string origins, string headers, string methods) where TContainer : class, IWebModuleContainer { @this.Modules.Add(new CorsModule(baseRoute, origins, headers, methods)); return @this; } /// /// Creates an instance of and adds it to a module container. /// /// The type of the module container. /// The on which this method is called. /// The valid origins. Default is "*", meaning all origins. /// The valid headers. Default is "*", meaning all headers. /// The valid method. Default is "*", meaning all methods. /// with a added. /// is . /// public static TContainer WithCors( this TContainer @this, string origins = CorsModule.All, string headers = CorsModule.All, string methods = CorsModule.All) where TContainer : class, IWebModuleContainer => WithCors(@this, UrlPath.Root, origins, headers, methods); } }