Use lowercase Github ratelimit headers to determine the ratelimit limit and reset time (#11194)
https://github.com/github/docs/pull/14912pull/11316/head
parent
bf451bd089
commit
fd62c6eb58
|
@ -154,15 +154,15 @@ class GitHub
|
|||
|
||||
foreach ($headers as $header) {
|
||||
$header = trim($header);
|
||||
if (false === strpos($header, 'X-RateLimit-')) {
|
||||
if (false === stripos($header, 'x-ratelimit-')) {
|
||||
continue;
|
||||
}
|
||||
list($type, $value) = explode(':', $header, 2);
|
||||
switch ($type) {
|
||||
case 'X-RateLimit-Limit':
|
||||
switch (strtolower($type)) {
|
||||
case 'x-ratelimit-limit':
|
||||
$rateLimit['limit'] = (int) trim($value);
|
||||
break;
|
||||
case 'X-RateLimit-Reset':
|
||||
case 'x-ratelimit-reset':
|
||||
$rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue