Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Make it possible to specify custom mime types for taste #365

Open
biohazard999 opened this issue Dec 12, 2019 · 0 comments
Open

Make it possible to specify custom mime types for taste #365

biohazard999 opened this issue Dec 12, 2019 · 0 comments

Comments

@biohazard999
Copy link
Contributor

biohazard999 commented Dec 12, 2019

I'm currently making static sites to download apps via msix. Cause the windows10 app installer needs specialized mime types I need a way to specify them for easier testing.

Proposed solution:
Similar approach like dotnet-serve does:
Add command line parameters that accept mime types with extention.

Second option would be a mime-type list in _config.yml to specify them permanently for the project.
Maybe we could provide both options.

Technically it's an easy change:
AspNetCoreWebHost.cs

   var contentTypeProvider = new FileExtensionContentTypeProvider();

            contentTypeProvider.Mappings[".appx"] = "application/appx";
            contentTypeProvider.Mappings[".msix"] = "application/msix";
            contentTypeProvider.Mappings[".appxbundle"] = "application/appxbundle";
            contentTypeProvider.Mappings[".msixbundle"] = "application/msixbundle";
            contentTypeProvider.Mappings[".appinstaller"] = "application/appinstaller";

  webHost = WebHost.CreateDefaultBuilder()
                .ConfigureLogging(l =>
                {
                    if (!Debug) l.ClearProviders();
                })
                .ConfigureKestrel(k => k.ListenLocalhost(Port))
                .Configure(config => config.UseDefaultFiles().UseStaticFiles(new StaticFileOptions
                {
                    ContentTypeProvider = contentTypeProvider
                }))
                .UseWebRoot(BasePath).Build();
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant