Esempio n. 1
0
 public function testGetAndSetReason()
 {
     $request = new Response();
     $request->setReason("I'M A LITTLE TEAPOT");
     $this->assertEquals("I'M A LITTLE TEAPOT", $request->getReason());
 }
Esempio n. 2
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);
     }
 }