Skip to content

Commit a83bf7e

Browse files
authored
Merge pull request #155 from YoitoFes/add_respbody_to_excp
Add http response body to HttpTokenResponseException
2 parents 1fd48dc + dd98db8 commit a83bf7e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

HTTPClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public function retrieveResponse(
2828
throw new HttpTokenResponseException(
2929
$msg . $http->error . ' [HTTP ' . $http->status . ']',
3030
$http->status,
31-
$http->error
31+
$http->error,
32+
$http->resp_body
3233
);
3334
}
3435

HttpTokenResponseException.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,28 @@ class HttpTokenResponseException extends TokenResponseException
1111
{
1212
protected $httpStatusCode = 0;
1313
protected $httpErrorMessage = "";
14+
protected $httpRespBody = "";
1415

1516
/**
1617
* @param string $message
1718
* @param int $httpStatusCode
1819
* @param string httpErrorMessage
20+
* @param mixed httpRespBody
1921
* @param int $code
2022
* @param \Throwable|null $previous
2123
*/
2224
public function __construct(
2325
$message = "",
2426
$httpStatusCode = 0,
2527
$httpErrorMessage = "",
28+
$httpRespBody = "",
2629
$code = 0,
2730
\Throwable $previous = null
2831
) {
2932
parent::__construct($message, $code, $previous);
3033
$this->httpStatusCode = $httpStatusCode;
3134
$this->httpErrorMessage = $httpErrorMessage;
35+
$this->httpRespBody = $httpRespBody;
3236
}
3337

3438
/**
@@ -50,4 +54,14 @@ public function getHttpErrorMessage()
5054
{
5155
return $this->httpErrorMessage;
5256
}
57+
58+
/**
59+
* Get the HTTP response body
60+
*
61+
* @return mixed
62+
*/
63+
public function getHttpRespBody()
64+
{
65+
return $this->httpRespBody;
66+
}
5367
}

0 commit comments

Comments
 (0)