diff --git a/src/RestClient.php b/src/RestClient.php index 669dffef69cd9003ad0d3d99e4cbfaa4b8cb75a1..7973ee8f2d9b825f5f2ecce5e5d691bda0aeb34f 100644 --- a/src/RestClient.php +++ b/src/RestClient.php @@ -84,7 +84,7 @@ class RestClient { } catch (RequestException $e) { // RequestException gets thrown for any response status but 2XX - $this->response = new RestResponse($e->getResponse()); + $this->response = $e->getResponse(); } if (!is_object($this->response)) { throw new Exception('Unknown error occurred during API call'); @@ -97,10 +97,10 @@ class RestClient { // throws anything but a RequestException, let it bubble up. $this->refreshToken(); try { - $this->response = $this->apiHttpRequest($path, $params, $method); + $this->response = new RestResponse($this->apiHttpRequest($path, $params, $method)); } catch (RequestException $e) { - $this->response = new RestResponse($e->getResponse()); + $this->response = $e->getResponse(); throw $e; } break;