how to compress(gzip) body of a request in guzzle 6
<p>need to send compressed (gzip) body to a server</p>

<p>e.g.</p>

<pre><code>    protected function postOrPutData($method, $data, $type, $uri = null, array $options = [])
    {
        $requestBody = $this-&gt;serializer-&gt;serialize($data, 'json');

        $request  = new Request($method, $uri, [], $requestBody);
        $response = $this-&gt;httpClient-&gt;send($request, $options);

        return $this-&gt;serializer-&gt;deserialize((string) $response-&gt;getBody(), $type, 'json');
    }
</code></pre>