diff options
Diffstat (limited to 'lib/private/http/client/response.php')
-rw-r--r-- | lib/private/http/client/response.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/private/http/client/response.php b/lib/private/http/client/response.php index 4e9df51d77f..558482491d1 100644 --- a/lib/private/http/client/response.php +++ b/lib/private/http/client/response.php @@ -34,17 +34,26 @@ class Response implements IResponse { private $response; /** + * @var bool + */ + private $stream; + + /** * @param GuzzleResponse $response + * @param bool $stream */ - public function __construct(GuzzleResponse $response) { + public function __construct(GuzzleResponse $response, $stream = false) { $this->response = $response; + $this->stream = $stream; } /** - * @return string + * @return string|resource */ public function getBody() { - return $this->response->getBody()->getContents(); + return $this->stream ? + $this->response->getBody()->detach(): + $this->response->getBody()->getContents(); } /** |