Skip to content
chrissie1 edited this page Dec 26, 2012 · 1 revision

You can also put the responsebody in a stream/

var httpClient = new HttpClient();
httpClient.StreamResponse = true;
httpClient.Get("http://localhost:16000/hello");
using (var stream = httpClient.Response.ResponseStream)
{
   int count;
   int total = 0;
   var buffer = new byte[8192];
   while ((count = stream.Read(buffer, 0, buffer.Length)) > 0)
   {
      total += count;
   }
}

The RawText property will be empty when setting StremResponse to true.

httpClient.Response.RawText
Clone this wiki locally