Skip to content

Commit 9d19af3

Browse files
authored
bug #1126 Fix detection of secondary rate limit (mathieudz)
This PR was squashed before being merged into the 3.12-dev branch. Discussion ---------- Actual error message is "You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later. If you reach out to GitHub Support for help, please include the request ID [...]" Commits ------- 661fccb Fix detection of secondary rate limit 7d8aeb6 Update secondary rate limit test with new message
1 parent 67398b0 commit 9d19af3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/Github/HttpClient/Plugin/GithubExceptionThrower.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
128128
}
129129

130130
$reset = (int) ResponseMediator::getHeader($response, 'X-RateLimit-Reset');
131-
if ((403 === $response->getStatusCode()) && 0 < $reset && isset($content['message']) && (0 === strpos($content['message'], 'You have exceeded a secondary rate limit.'))) {
131+
if ((403 === $response->getStatusCode()) && 0 < $reset && isset($content['message']) && (0 === strpos($content['message'], 'You have exceeded a secondary rate limit'))) {
132132
$limit = (int) ResponseMediator::getHeader($response, 'X-RateLimit-Limit');
133133

134134
throw new ApiLimitExceedException($limit, $reset);

test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public static function responseProvider()
103103
],
104104
json_encode(
105105
[
106-
'message' => 'You have exceeded a secondary rate limit. Please wait a few minutes before you try again.',
106+
'message' => 'You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later. If you reach out to GitHub Support for help, please include the request ID #xxxxxxx.',
107107
]
108108
)
109109
),

0 commit comments

Comments
 (0)