I'm trying to post some JSON to an external API which keeps failing because my content is chunked. Please can someone tell me how to disable it?
I'm using ASP.NET 5 so think I'm using System.Net.Http, Version=4.0.1.0
Here is the code I've tried:
using (var client = new HttpClient())
{
// TODO - Send HTTP requests
client.BaseAddress = new Uri(apiBaseUrl);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("SAML", samlToken);
client.DefaultRequestHeaders.TransferEncodingChunked = false;
HttpResponseMessage response = await client.PostAsJsonAsync(path, jsonObject);
}
But It still seems to have the Transfer-Encoding set to "chunked" when I check Fiddler.
Can anyone help with this?