Table of Contents

HTTP - Accept-Encoding

About

accept-encoding 1) is a request header that lists the encoding format that the client can read.

Example

With a get request

GET https://datacadamia.com/web/http/method HTTP/1.1
Accept-Encoding: gzip, deflate, br

Example of values

Accept-Encoding:                   
Accept-Encoding: compress, gzip
Accept-Encoding: *
Accept-Encoding: compress;q=0.5, gzip;q=1.0
Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0

where the value tells the content coding 2) what the client will accept

Content coding Value Description
empty value the client accept any content coding (by default, the server should return the identity content coding)
compress The format produced by the UNIX compression program “compress” (adaptive Lempel-Ziv-Welch coding (LZW))
gzip The format produced by the file compression program gzip (GNU zip)
* matches any available content-coding

What if the encoding is not available ?

If the server cannot send a acceptable response, it would send an error response with the 406 (Not Acceptable) status code.