diff --git a/src/Util/ApiLoader.php b/src/Util/ApiLoader.php index 179901c..c3c2eb5 100644 --- a/src/Util/ApiLoader.php +++ b/src/Util/ApiLoader.php @@ -21,7 +21,7 @@ abstract class ApiLoader use Extensible; private static $dependencies = [ - 'GuzzleClient' => '%$GuzzleHttp\Client', + 'GuzzleClient' => '%$' . Client::class, ]; /** @@ -62,7 +62,7 @@ public function doRequest($endpoint, callable $callback) try { /** @var Response $response */ - $response = $this->getGuzzleClient()->send($request, ['http_errors' => false]); + $response = $this->getGuzzleClient()->send($request, $this->getClientOptions()); } catch (GuzzleException $exception) { throw new RuntimeException($failureMessage); } @@ -112,6 +112,20 @@ public function setGuzzleClient(Client $guzzleClient) return $this; } + /** + * Get Guzzle client options + * + * @return array + */ + public function getClientOptions() + { + $options = [ + 'http_errors' => false, + ]; + $this->extend('updateClientOptions', $options); + return $options; + } + /** * Attempts to load something from the cache and deserializes from JSON if successful *