Skip to content

Commit

Permalink
Merge pull request #29 from picqer/fix-setting-remaining-limit
Browse files Browse the repository at this point in the history
Correctly extract remaining rate limit from API result headers
  • Loading branch information
annajeanine authored Jan 13, 2021
2 parents 5e54dc0 + 27018bf commit fff6198
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1165,15 +1165,15 @@ protected function parseRawHeaders()
continue;
}

$parsedHeaders[$headerPieces[0]] = trim($headerPieces[1]);
$parsedHeaders[strtolower($headerPieces[0])] = trim($headerPieces[1]);
}

return $parsedHeaders;
}

protected function getRemainingRateLimit(array $apiResultHeaders)
{
return (array_key_exists('X-RateLimit-Remaining', $apiResultHeaders)) ? $apiResultHeaders['X-RateLimit-Remaining'] : null;
return (array_key_exists('x-ratelimit-remaining', $apiResultHeaders)) ? $apiResultHeaders['x-ratelimit-remaining'] : null;
}

protected function setPostData($curlSession, $method, $params)
Expand Down

0 comments on commit fff6198

Please sign in to comment.