ご参考までに、該当箇所のBlazorのソースとリクエストヘッダーです。
クライアント側
@if (hoge is null)
{
<p><em>Loading...</em></p>
}
else
{
<h1>Http Response</h1>
<div>@hoge?.Length</div>
}
@code {
private WeatherForecast[]? forecasts;
private string? hoge = null;
protected override async Task OnInitializedAsync()
{
var repsonse = await Http.PostAsJsonAsync<string>("WeatherForecast", "");
var fuga = await repsonse.Content.ReadFromJsonAsync<Dictionary<string,string>>();
hoge = fuga is null ? "" : fuga["hoge"];
}
}
---------------------------------------------------------------
サーバー側
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
[HttpPost]
public async Task<IActionResult> Post()
{
await Task.Delay(1000);//無駄に1秒待たせる
dynamic r = Ok(new Dictionary<string, string> { { "hoge", new String('a', 135000) + "z" } });
return r;
}
}
---------------------------------------------------------------
リクエストヘッダー
POST /WeatherForecast HTTP/2
Host: localhost:44315
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0
Accept: */*
Accept-Language: ja,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer:
https://localhost:44315/fetchdatacontent-type: application/json; charset=utf-8
Origin:
https://localhost:44315Content-Length: 2
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin