public static IAppBuilder UseExtensionlessUrls(this IAppBuilder builder, ExtensionlessUrlsOptions options)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.Use <ExtensionlessUrlsMiddleware>(options));
        }
Esempio n. 2
0
        public ExtensionlessUrlsMiddleware(AppFunc next, ExtensionlessUrlsOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (options.FileSystem == null)
            {
                options.FileSystem = new PhysicalFileSystem(".");
            }
            options.DefaultExtensions =
                options.DefaultExtensions.Select(x => x.StartsWith(".") ? x : ("." + x)).ToList();

            _next    = next;
            _options = options;
        }