Do I need to specify in my request that I wish to accept gzip, or is this default behavior? I am talking to a WCF RESTful Json service.
// Create the web request
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
request.Headers["Accept-Encoding"] = "gzip";
Actually, you should just set AutomaticDecompression
, the WebRequest
will set Accept-Encoding
for you automatically.
request.AutomaticDecompression = DecompressionMethods.GZip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With