picqer / picqer-php

PHP Client for the Picqer API
https://picqer.com/en/api
MIT License
18 stars 23 forks source link

Method handleRateLimitReached wrong implemented in sendRequest method #41

Closed kevinkoenen closed 1 year ago

kevinkoenen commented 1 year ago

Hi Picqer,

In the Client.php is the method handleRateLimitReached wrong implemented. The local $headerInfo variable in the method sendRequest will never be updated again after calling handleRateLimitReached.

To fix this, you have to return the result of the handleRateLimitReached directly instead of saving it to the $result variable.

See https://github.com/picqer/picqer-php/blob/main/src/Client.php#L1188C33-L1188C33 for more information.

Instead of

$result = $this->handleRateLimitReached($endpoint, $params, $method, $filters);

Fix:

return $this->handleRateLimitReached($endpoint, $params, $method, $filters);

With kind regards, Kevin Koenen

casperbakker commented 1 year ago

Good find @kevinkoenen. We use this ourselves a lot, but never hit this bug. But it definitely was wrong. I now fixed it in the newest release. Thanks!

kevinkoenen commented 1 year ago

Thanks Casper for the quick response and fix!