Skip to content

Commit 10039ab

Browse files
committed
[wasm] WasmAppHost: fix new analyzer warning
`/__w/1/s/src/mono/wasm/host/WebServerStartup.cs(94,17): error ASP0019: Use IHeaderDictionary.Append or the indexer to append or set headers. IDictionary.Add will throw an ArgumentException when attempting to add a duplicate key. [/__w/1/s/src/mono/wasm/host/WasmAppHost.csproj] `
1 parent af2698d commit 10039ab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/mono/wasm/host/WebServerStartup.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using Microsoft.AspNetCore.Builder;
1414
using Microsoft.AspNetCore.Hosting;
1515
using Microsoft.AspNetCore.Hosting.Server.Features;
16+
using Microsoft.AspNetCore.Http;
1617
using Microsoft.AspNetCore.Routing;
1718
using Microsoft.AspNetCore.StaticFiles;
1819
using Microsoft.Extensions.FileProviders;
@@ -91,8 +92,8 @@ public void Configure(IApplicationBuilder app,
9192
{
9293
app.Use((context, next) =>
9394
{
94-
context.Response.Headers.Add("Cross-Origin-Embedder-Policy", "require-corp");
95-
context.Response.Headers.Add("Cross-Origin-Opener-Policy", "same-origin");
95+
context.Response.Headers.Append("Cross-Origin-Embedder-Policy", "require-corp");
96+
context.Response.Headers.Append("Cross-Origin-Opener-Policy", "same-origin");
9697
return next();
9798
});
9899
}

0 commit comments

Comments
 (0)