Skip to content

Commit

Permalink
Merge pull request #15 from AdamRollinson/main
Browse files Browse the repository at this point in the history
Ability to set the http client timeout via config
  • Loading branch information
jszobody authored Jul 27, 2023
2 parents 573ce21 + 668e781 commit 2f032e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config/hubspot.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@
'include_associations' => ['companies', 'contacts', 'deals', 'tickets'],
],

'http' => [
'timeout' => env('HUBSPOT_HTTP_TIMEOUT', 10),
],
];
3 changes: 2 additions & 1 deletion src/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public function prefix($uri): string

public function http(): PendingRequest
{
return Http::withToken($this->accessToken)
return Http::timeout(config('hubspot.http.timeout', 10))
->withToken($this->accessToken)
->throw(function (Response $response, RequestException $exception) {
if ($response->json('category') === 'RATE_LIMITS') {
throw new RateLimitException($response, $exception);
Expand Down

0 comments on commit 2f032e9

Please sign in to comment.