From e812aa6c58d90fef4d97e2bdb113eebb11de9647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Fali=C3=A8s?= Date: Sat, 28 Mar 2020 10:35:44 +0100 Subject: [PATCH] Fix http response for all php version --- src/VfacTmdb/Tmdb.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/VfacTmdb/Tmdb.php b/src/VfacTmdb/Tmdb.php index 11f8ede..53c4023 100644 --- a/src/VfacTmdb/Tmdb.php +++ b/src/VfacTmdb/Tmdb.php @@ -168,8 +168,11 @@ protected function sendRequest(string $method, string $url, array $form_params = */ private function decodeRequest($res, $method, $url, $form_params) : \stdClass { - $content = $res->getBody()->getContents(); + $content = $res->getBody(); + if ( ! is_string($content)) { + $content = $content->getContents(); + } if (empty($content)) { $this->logger->error('Request Body empty', array('method' => $method, 'url' => $url, 'form_params' => $form_params)); throw new ServerErrorException();