diff --git a/HTTPClient.php b/HTTPClient.php index d723515..7f54e6a 100644 --- a/HTTPClient.php +++ b/HTTPClient.php @@ -28,7 +28,8 @@ class HTTPClient implements ClientInterface throw new HttpTokenResponseException( $msg . $http->error . ' [HTTP ' . $http->status . ']', $http->status, - $http->error + $http->error, + $http->resp_body ); } diff --git a/HttpTokenResponseException.php b/HttpTokenResponseException.php index c423139..be493c7 100644 --- a/HttpTokenResponseException.php +++ b/HttpTokenResponseException.php @@ -11,11 +11,13 @@ class HttpTokenResponseException extends TokenResponseException { protected $httpStatusCode = 0; protected $httpErrorMessage = ""; + protected $httpRespBody = ""; /** * @param string $message * @param int $httpStatusCode * @param string httpErrorMessage + * @param mixed httpRespBody * @param int $code * @param \Throwable|null $previous */ @@ -23,12 +25,14 @@ class HttpTokenResponseException extends TokenResponseException $message = "", $httpStatusCode = 0, $httpErrorMessage = "", + $httpRespBody = "", $code = 0, \Throwable $previous = null ) { parent::__construct($message, $code, $previous); $this->httpStatusCode = $httpStatusCode; $this->httpErrorMessage = $httpErrorMessage; + $this->httpRespBody = $httpRespBody; } /** @@ -50,4 +54,14 @@ class HttpTokenResponseException extends TokenResponseException { return $this->httpErrorMessage; } + + /** + * Get the HTTP response body + * + * @return mixed + */ + public function getHttpRespBody() + { + return $this->httpRespBody; + } }