2016-08-10 3 views
1

サーバに圧縮(gzip)本体を送る必要があります。guzz 6の要求の本体を圧縮する方法(gzip)

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

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

     return $this->serializer->deserialize((string) $response->getBody(), $type, 'json'); 
    } 

答えて

0

私はあなたもsimilar question about pure cURLからインスピレーションを得ることができると思います。

$options['curl'] = [CURLOPT_ENCODING => 'gzip']; 

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

はがつがつ食うと、このカスタム設定を(私はあなたがcURLのハンドラでそれを使用していると仮定)を使用するようにしてください

関連する問題