Method HttpRequestMessage() :setAcceptEncoding() Foundation

Defines the accepted encoding for responses from the server.

Syntax
 
:setAcceptEncoding( <cEncoding> | <aEncodings> ) --> self
Parameters
<cEncoding>
A character string with the name of the encoding. Instead of specifying a specific encoding, the wildcard character * may be used which denotes "accepts any encoding". The following table lists the encodings currently supported.
Encodings supported by :setAcceptEncoding()
Name Description
gzip Compression format using the Lempel-Ziv coding (LZ77), with a 32-bit CRC
compress Compression format using the Lempel-Ziv-Welch (LZW) algorithm
deflate Compression format using the zlib structure, uses the deflate compression algorithm
br Compression format using the Brotli algorithm
identity No compression, no modification *)
  1. Default unless specified otherwise via :setAcceptEncoding()
<aLanguages>
An array of encodings as described for the <cEncoding> parameter. The elements in the array can optionally be weighted by using a so-called quality value. The quality value is a value between 0 and 1 denoting the language's priority. A weight value of 1 (the default) is equivalent to the highest priority.
Example: :setAcceptEncoding( {"br;q=1.0", "gzip;q=0.8", "*;q=0"} )
Return

:setAcceptEncoding() returns the object executing the method.

Description

The method :setAcceptEncoding() specifies to the server which encoding(s) is expected for processing data sent by the server.

The accepted encoding is a discretionary element in the request header. The "Content-Encoding" HTTP header in the server's response should be checked prior to processing the response data. See the method :getHeaders() for further information.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.