SocketsHttpHandler.AutomaticDecompression Property

Definition

Gets or sets the type of decompression method used by the handler for automatic decompression of the HTTP content response.

C#
public System.Net.DecompressionMethods AutomaticDecompression { get; set; }

Property Value

The type of decompression method used by the handler for automatic decompression of the HTTP content response.

Exceptions

An operation has already been started on the current instance.

The current instance has been disposed.

Remarks

Automatic decompression works only on the top most compression. So if the content is compressed multiple times, only the last compression will be decompressed. For example, for a response with Content-Encoding: gzip, br header that contains content first compressed with gzip and then with Brotli, the content will only be decompressed using Brotli, leaving the still gzipped content in the Content.

Setting automatic decompression to anything other than None will result in adding Accept-Encoding header with the set values into every outgoing HttpRequestMessage.

Applies to

Produkt Verzie
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10