zf2 decodeGzip, ¿por qué está protegido?

I'm getting back what appears to be gzipped data in a call to a zf2 api. The content-type is gzip, and the content body looks encoded. So I tried this:

    $decoded = $response->decodeGzip($response->getContent());

and I got back this error:

Call to protected method Zend\Http\Response::decodeGzip()

Why is it protected? It seems like decoding gzipped data would be a handy thing to be able to do.

preguntado el 10 de septiembre de 13 a las 00:09

1 Respuestas

Deberías usar $response->getBody(). getBody() El método comprueba el Content-Encoding header and if this is gzip, it will extract the body from the Gzipped content.

You can check this method in the online repository: Zend\Http\Response

Respondido 20 Jul 14, 13:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.