Skip to content

Commit

Permalink
Merge pull request #13 from productflowbv/features/kaufland-v2
Browse files Browse the repository at this point in the history
fix 204 responses during parsing
  • Loading branch information
jeroensurft authored Jan 10, 2023
2 parents 5a4bfe4 + 4db7b5c commit 8f45ff1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ private function parseResponse(ResponseInterface $response): array
$response_body = $response->getBody()->getContents();
$result_array = json_decode($response_body, true);

if ($response->getStatusCode() === 204) {
return [];
}

if (! is_array($result_array)) {
throw new KauflandException(sprintf('Kaufland error %s: %s', $response->getStatusCode(), $response_body), $response->getStatusCode());
}
Expand Down

0 comments on commit 8f45ff1

Please sign in to comment.