Skip to content

Commit

Permalink
use straight raw response in error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
srjlewis committed May 30, 2020
1 parent 30bbdf7 commit c2c720a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/JsonRPC/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,10 @@ public function execute($payload, array $headers = array())
}

if ($this->debug) {
$debugResponse = json_decode($rawResponse, true);
if ($debugResponse && json_last_error() === JSON_ERROR_NONE) {
$debugResponse = json_encode($response, JSON_PRETTY_PRINT);
} else {
$debugResponse = $rawResponse;
}
error_log('==> Request: ' . PHP_EOL . implode(PHP_EOL,
$requestHeaders) .PHP_EOL . PHP_EOL . (is_string($payload) ? $payload : json_encode($payload,
JSON_PRETTY_PRINT)));
error_log('==> Response: ' . PHP_EOL . implode('', $headers) . PHP_EOL . $debugResponse);
error_log('==> Response: ' . PHP_EOL . implode('', $headers) . $rawResponse);
}

$this->handleExceptions($headers);
Expand Down

0 comments on commit c2c720a

Please sign in to comment.