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

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

@biohazard999

Description

@biohazard999

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions