Skip to content

Commit

Permalink
Remove useless condition
Browse files Browse the repository at this point in the history
  • Loading branch information
gsteel committed Sep 6, 2023
1 parent 756e6a4 commit 8dc91e1
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/Common/HttpLayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down

0 comments on commit 8dc91e1

Please sign in to comment.