title: HttpClient truncate response content
body: <p>I did some request using <code>httpclient</code>. One with <code>Content-Type:application/json</code> and the other one with <code>Content-Type:application/xml</code>.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>HttpClient client = new HttpClient();
  HttpRequestMessage request = new HttpRequestMessage();
  request.Method = HttpMethod.Post;
  request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/xml"));
  request.Content = new StringContent(BodyContent, Encoding.UTF8, "application/xml");
  
  client.BaseAddress = new Uri(baseUrl);
  var response = await client.SendAsync(request, HttpCompletionOption.ResponseContentRead);
  var responseText = await response.Content.ReadAsStringAsync();
  Result = responseText.ToString();
  client.Dispose();
  request.Dispose();
  </code></pre>
  
  <p>This code works perfectly when content type is <code>json</code>, but sometimes return truncated response contents when it comes from content type <code>xml</code>. That in my case, returned string content from <code>json</code> longer than <code>xml</code>.</p>
  
  <p>Here example of response <a href="https://drive.google.com/open?id=0B9xOAWKNoW2GcjdGWFNaQS1rYWc" rel="nofollow noreferrer" title="example xml response">example.xml</a></p>
  
  <p>Do you have any idea why this is happening?</p>