Skip to content

Commit

Permalink
Merge pull request #16 from qkdreyer/patch-2
Browse files Browse the repository at this point in the history
fix: handle json key correctly
  • Loading branch information
sandvige authored Jul 23, 2024
2 parents 12a1c4f + 6c5057b commit 89c1a17
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ApiMapper/ApiMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,11 @@ public function __call($method, $arguments)
"response" => $response,
"parameters" => $parameters,
"fields" => $fields,
"body" => str_starts_with($response->getHeaderLine('Content-Type'), 'application/json') ? json_decode($response->getBody(), true) : (string) $response->getBody(),
"json" => \json_last_error() === \JSON_ERROR_NONE,
"json" => str_starts_with($response->getHeaderLine('Content-Type'), 'application/json'),
);

$content["body"] = $content['json'] ? json_decode($response->getBody(), true) : (string) $response->getBody();

// Dispatch content to event listeners
$this->dispatch($content);

Expand Down

0 comments on commit 89c1a17

Please sign in to comment.