Skip to content

Commit

Permalink
Fix handling of empty response (#364)
Browse files Browse the repository at this point in the history
Closes #363

Co-authored-by: Shishir <[email protected]>
Co-authored-by: Kedar Khaire <[email protected]>
  • Loading branch information
3 people authored May 24, 2024
1 parent 3073f76 commit dd20c63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Controller/NonPaginatedEntityListingControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Trait NonPaginatedEntityListingControllerTrait.
*
* @see \Apigee\Edge\Controller\NonPaginatedEntityListingControllerInterface
* @see NonPaginatedEntityListingControllerInterface
*/
trait NonPaginatedEntityListingControllerTrait
{
Expand All @@ -43,6 +43,9 @@ public function getEntities(): array
$uri = $this->getBaseEndpointUri()->withQuery(http_build_query($query_params));
$response = $this->getClient()->get($uri);
$responseArray = $this->responseToArray($response);
if ([] === $responseArray) {
return [];
}
// Ignore entity type key from response, ex.: apiProduct.
$responseArray = reset($responseArray);

Expand Down

0 comments on commit dd20c63

Please sign in to comment.