Skip to content

Commit

Permalink
Also return raw body
Browse files Browse the repository at this point in the history
  • Loading branch information
iwiznia committed Dec 31, 2024
1 parent c23b7aa commit adef609
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,13 +707,17 @@ private function receiveResponse()
// We'll parse the body *only* if this is `application/json` or blank.
$isJSON = !isset($responseHeaders['Content-Type']) || !strcasecmp($responseHeaders['Content-Type'], 'application/json');

return [
$result = [
'headers' => $responseHeaders,
'body' => $isJSON ? $this->parseRawBody($responseHeaders, $response) : $response,
'size' => $totalDataReceived,
'codeLine' => $codeLine,
'code' => intval($codeLine),
];
if ($isJSON) {
$result['rawBody'] = $response;
}
return $result;
}

/**
Expand Down

0 comments on commit adef609

Please sign in to comment.