Skip to content

Commit 6f378c8

Browse files
committed
Enable http_errors option only if needed.
The BaseHttpClient needs to handle 429 Too Many Requests.
1 parent 4062dbc commit 6f378c8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Client.php

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ private function send(RequestInterface $request)
6363
{
6464
return $this->httpClient->send($request, [
6565
'base_uri' => $this->endpoint->getHost(),
66-
'http_errors' => true,
6766
]);
6867
}
6968
}

src/HttpClient/BaseHttpClient.php

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use easybill\SDK\HttpClientInterface;
44
use GuzzleHttp\Exception\ClientException;
5+
use GuzzleHttp\RequestOptions;
56
use Psr\Http\Message\RequestInterface;
67

78
class BaseHttpClient implements HttpClientInterface
@@ -35,6 +36,10 @@ public function __construct(HttpClientInterface $httpClient, $maxApiCallsPerMinu
3536
public function send(RequestInterface $request, array $options = [])
3637
{
3738
$this->checkAndWaitForCall();
39+
40+
// TODO:: Improve this client and allow to deal with both options.
41+
$options[RequestOptions::HTTP_ERRORS] = true;
42+
3843
try {
3944
$res = $this->httpClient->send($request, $options);
4045
$this->apiCalls[] = time();

0 commit comments

Comments
 (0)