我想这样做,接受COM pressed响应的请求
I am trying to do a request that accepts a compressed response
var request = (HttpWebRequest)HttpWebRequest.Create(requestUri);
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
我不知道当我添加第二行,我将不得不手动处理DECOM pression。
I wonder if when I add the second line I will have to handle the decompression manually.
我找到了答案。
您可以更改code到:
You can change the code to:
var request = (HttpWebRequest)HttpWebRequest.Create(requestUri);
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
和您将有自动DECOM pression。无需更改的code中的其余部分。
And you will have automatic decompression. No need to change the rest of the code.