Example #1
0
 private function inflateGzipBody(Response $response)
 {
     $src = $response->getBody();
     if (is_resource($src)) {
         $destination = fopen('php://memory', 'r+');
         fseek($src, 10, SEEK_SET);
         stream_filter_prepend($src, 'zlib.inflate', STREAM_FILTER_READ);
         stream_copy_to_stream($src, $destination);
         rewind($destination);
         $response->setBody($destination);
     } elseif (strlen($src)) {
         $body = gzdecode($src);
         $response->setBody($body);
     }
 }