Skip to content

Commit

Permalink
Support compression for blazor wasm related files (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertwoo committed Sep 15, 2022
1 parent bdef61d commit 990d0ae
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/dotnet-serve/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ public void ConfigureServices(IServiceCollection services)
{
options.Providers.Clear();
if (_options.UseGzip == true || _options.UseBrotli == true)
{
options.MimeTypes = ResponseCompressionDefaults.MimeTypes
.Append("application/dll")
.Append("application/dat");
}
if (_options.UseGzip == true)
{
options.Providers.Add<GzipCompressionProvider>();
Expand Down Expand Up @@ -153,6 +160,10 @@ private void ConfigureFileServer(IApplicationBuilder app)
}

var contentTypeProvider = new FileExtensionContentTypeProvider();

contentTypeProvider.Mappings.Add(".dll", "application/dll");
contentTypeProvider.Mappings.Add(".dat", "application/dat");

var mimeMappings = _options.GetMimeMappings();
if (mimeMappings != null)
{
Expand Down

0 comments on commit 990d0ae

Please sign in to comment.