decode_content
Summary
: Specify whether or not Content-Encoding responses (gzip,deflate, etc.) are automatically decoded.
Types : - string - bool
Default
: true
Constant
: GuzzleHttp\RequestOptions::DECODE_CONTENT
This option can be used to control how content-encoded response bodies arehandled. By default, decode_content is set to true, meaning any gzippedor deflated response will be decoded by Guzzle.
When set to false, the body of a response is never decoded, meaning thebytes pass through the handler unchanged.
1. // Request gzipped data, but do not decode it while downloading
2. $client->request('GET', '/foo.js', [
3. 'headers' => ['Accept-Encoding' => 'gzip'],
4. 'decode_content' => false
5. ]);
When set to a string, the bytes of a response are decoded and the string valueprovided to the decode_content option is passed as the Accept-Encodingheader of the request.
1. // Pass "gzip" as the Accept-Encoding header.
2. $client->request('GET', '/foo.js', ['decode_content' => 'gzip']);
