Skip to content

Commit

Permalink
Merge pull request #296 from holtkamp/patch-1
Browse files Browse the repository at this point in the history
Respect that headers are returned as array
  • Loading branch information
stephangroen authored Jun 7, 2024
2 parents d2d40b8 + 35d18df commit 56a7d6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Picqer/Financials/Moneybird/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ private function checkWhetherRateLimitHasBeenReached(ResponseInterface $response
if ($response->getStatusCode() === 429 && count($rateLimitRemainingHeaders) > 0) {
$exception = new TooManyRequestsException('Error ' . $response->getStatusCode() . ': ' . $errorMessage, $response->getStatusCode());
$exception->retryAfterNumberOfSeconds = (int) current($rateLimitRemainingHeaders);
$exception->currentRateLimit = (int) $response->getHeader('RateLimit-Limit');
$exception->rateLimitResetsAfterTimestamp = (int) $response->getHeader('RateLimit-Reset');
$exception->currentRateLimit = (int) current($response->getHeader('RateLimit-Limit'));
$exception->rateLimitResetsAfterTimestamp = (int) current($response->getHeader('RateLimit-Reset'));

throw $exception;
}
Expand Down

0 comments on commit 56a7d6f

Please sign in to comment.