HttpClient and compression

Topics: Web Api
Jan 31, 2012 at 5:15 PM
Edited Jan 31, 2012 at 5:18 PM

I already read the topic here: but it looks like it's now working in preview 6.

I host my service in IIS7 (full, not express) and the compression is enabled.

The service is very simple and the client is a console application requesting a json result (via accept header).

var handler = new WebRequestHandler();
handler.AutomaticDecompression =System.Net.DecompressionMethods.GZip | System.Net.DecompressionMethods.Deflate;
_client = new HttpClient(handler);
_client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
_client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("deflate"));

I can read the json string from the service but Fiddler show the result as uncompressed.

Should I do anything else?