Skip to content

Commit

Permalink
Update WHMv1/Provider::processResponse() return response_body in resu…
Browse files Browse the repository at this point in the history
…lt data
  • Loading branch information
uphlewis committed Jul 25, 2024
1 parent fbe25c1 commit 59e4a7e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/WHMv1/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,6 @@ protected function asyncApiCall(
$data = [
'function' => $function,
];
$debug = [];

if ($e instanceof TransferException) {
if ($e instanceof RequestException && $e->hasResponse()) {
Expand All @@ -976,7 +975,7 @@ protected function asyncApiCall(
$data['result_data'] = $resultData;

if (!$resultData) {
$debug['response_body'] = Str::limit($responseBody, 500);
$data['response_body'] = Str::limit($responseBody, 500);
}
} else {
$message = 'WHM API Connection Error';
Expand All @@ -987,7 +986,7 @@ protected function asyncApiCall(
$message = 'WHM API Request Timeout';
}

$this->errorResult($message, $data, $debug, $e);
$this->errorResult($message, $data, [], $e);
}

throw $e;
Expand Down Expand Up @@ -1015,13 +1014,12 @@ protected function processResponse(
}

$data = ['http_code' => $http_code, 'result_data' => $result_data, 'result_meta' => $result_meta];
$debug = [];

if (empty($result_data)) {
$debug['response_body'] = Str::limit($response->getPsr7()->getBody()->__toString(), 300);
$data['response_body'] = Str::limit($response->getPsr7()->getBody()->__toString(), 300);
}

$this->errorResult('WHM API Error: ' . $message, $data, $debug);
$this->errorResult('WHM API Error: ' . $message, $data);
}

protected function getSoftaculous(string $username, string $password): SoftaculousSdk
Expand Down

0 comments on commit 59e4a7e

Please sign in to comment.