From 8dc91e19d304cb3eded14b4755dbb6790775824b Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 6 Sep 2023 20:39:41 +0100 Subject: [PATCH] Remove useless condition --- src/Common/HttpLayer.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Common/HttpLayer.php b/src/Common/HttpLayer.php index 4391223..2016294 100644 --- a/src/Common/HttpLayer.php +++ b/src/Common/HttpLayer.php @@ -132,16 +132,12 @@ protected function buildResponse(ResponseInterface $response): array $contentType = $response->hasHeader('Content-Type') ? reset($contentTypes) : null; - $body = ''; - - if ($response->getBody()) { - switch ($contentType) { - case 'application/json': - $body = json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); - break; - default: - $body = $response->getBody()->getContents(); - } + switch ($contentType) { + case 'application/json': + $body = json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); + break; + default: + $body = $response->getBody()->getContents(); } return [