From 51ecbf333d20e1ed5c5ead3c85c1f5c958d8840a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 8 Mar 2022 12:55:35 -0800 Subject: [PATCH] [release/6.0] [wasm][debugger] Fix (chrome|edge)://inspect for the debug proxy (#65219) * Inspector wants the content-length set * Use utf8 length Co-authored-by: Larry Ewing --- src/mono/wasm/debugger/BrowserDebugHost/Startup.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs b/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs index c4de27f4ee9f6..8583186ad64fd 100644 --- a/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs +++ b/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Net.Http; using System.Text.Json; +using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -139,7 +140,9 @@ async Task RewriteArray(HttpContext context) Dictionary[] tabs = await ProxyGetJsonAsync[]>(GetEndpoint(context)); Dictionary[] alteredTabs = tabs.Select(t => mapFunc(t, context, devToolsHost)).ToArray(); context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(alteredTabs)); + byte[] bytes = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(alteredTabs)); + context.Response.ContentLength = bytes.Length; + await context.Response.Body.WriteAsync(bytes); } async Task ConnectProxy(HttpContext context)