Question Details

No question body available.

Tags

azure-functions azure-web-app-service httpclient .net-8.0 system.net.http.json

Answers (1)

Accepted Answer Available
Accepted Answer
May 3, 2026 Score: 3 Rep: 7,948 Quality: High Completeness: 80%

PostAsJsonAsync is really an extension method that uses JsonContent instead of StringContent. Problem might be that JsonContent is using chunked encoding by default which was documented as an issue for Azure Logic Apps HTTP triggers. More info in this github issue:

I have to say the Azure Logic App HTTP trigger doesn't support "chunked encoding". In Handle large messages with chunking in Azure Logic Apps doc, it says:

Logic App triggers don't support chunking because of the increased overhead of exchanging multiple messages.

I was trying to POST a message to Azure Logic App with a HTTP trigger. It because HttpClient's PostAsJsonAsync ONLY support chunked encoding by default. I know what @davidfowl said not recommend buffering for large JSON payloads, but most of the payload to the Azure Logic App are really small. I think it should have an straightforward option to use PostAsJsonAsync without chunked encoding.

You can test the work-around mentioned there to test if that's indeed the problem for Azure Functions HTTP trigger as well.

var content = JsonContent.Create(json);
await content.LoadIntoBufferAsync();
var response = await httpClient.PostAsync(url, content);

If it helps, you can turn the code easily in a convenient extension method similar to PostAsJsonAsync.