Use "application/wasm" media type for .wasm files to enable streaming compilation
This commit is contained in:
parent
e3b995b933
commit
1d07783522
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Blazor.Server;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
@ -21,8 +22,11 @@ namespace Microsoft.AspNetCore.Blazor.Cli.Server
|
||||||
services.AddRouting();
|
services.AddRouting();
|
||||||
services.AddResponseCompression(options =>
|
services.AddResponseCompression(options =>
|
||||||
{
|
{
|
||||||
options.MimeTypes = ResponseCompressionDefaults.MimeTypes
|
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[]
|
||||||
.Concat(new[] { MediaTypeNames.Application.Octet });
|
{
|
||||||
|
MediaTypeNames.Application.Octet,
|
||||||
|
WasmMediaTypeNames.Application.Wasm
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ using Microsoft.AspNetCore.StaticFiles;
|
||||||
using Microsoft.Extensions.FileProviders;
|
using Microsoft.Extensions.FileProviders;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Builder
|
namespace Microsoft.AspNetCore.Builder
|
||||||
{
|
{
|
||||||
|
|
@ -81,7 +80,7 @@ namespace Microsoft.AspNetCore.Builder
|
||||||
var result = new FileExtensionContentTypeProvider();
|
var result = new FileExtensionContentTypeProvider();
|
||||||
result.Mappings.Add(".dll", MediaTypeNames.Application.Octet);
|
result.Mappings.Add(".dll", MediaTypeNames.Application.Octet);
|
||||||
result.Mappings.Add(".mem", MediaTypeNames.Application.Octet);
|
result.Mappings.Add(".mem", MediaTypeNames.Application.Octet);
|
||||||
result.Mappings.Add(".wasm", MediaTypeNames.Application.Octet);
|
result.Mappings.Add(".wasm", WasmMediaTypeNames.Application.Wasm);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
using System.Collections.Generic;
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Builder
|
namespace Microsoft.AspNetCore.Builder
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Blazor.Server
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Contains values for WASM-related media types.
|
||||||
|
/// </summary>
|
||||||
|
public static class WasmMediaTypeNames
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Contains values for WASM-related media types within the "application." namespace
|
||||||
|
/// </summary>
|
||||||
|
public static class Application
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The standard media type name for WebAssembly binary files.
|
||||||
|
/// </summary>
|
||||||
|
public const string Wasm = "application/wasm";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue