pretzel
pretzel copied to clipboard
Make it possible to specify custom mime types for taste
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();