ContentEncoding

fun HttpClientConfig<*>.ContentEncoding(mode: ContentEncodingConfig.Mode = ContentEncodingConfig.Mode.DecompressResponse, block: ContentEncodingConfig.() -> Unit = { gzip() deflate() identity() })

Installs or configures the ContentEncoding plugin.

Parameters

block

: a ContentEncoding configuration.


A plugin that allows you to enable specified compression algorithms (such as gzip and deflate) and configure their settings. This plugin serves two primary purposes:

  • Sets the Accept-Encoding header with the specified quality value.

  • Decodes content received from a server to obtain the original payload.

You can learn more from Content encoding.