type, T instance, int timeouts) throws IOException
// See https://developer.github.com/v3/repos/statistics/#a-word-about-caching
// And for fork creation:
// See https://developer.github.com/v3/repos/forks/#create-a-fork
- if (responseCode == 202) {
+ if (responseCode == HttpURLConnection.HTTP_ACCEPTED) {
if (uc.getURL().toString().endsWith("/forks")) {
LOGGER.log(INFO, "The fork is being created. Please try again in 5 seconds.");
} else if (uc.getURL().toString().endsWith("/statistics")) {
@@ -1023,19 +1051,11 @@ private InputStream wrapStream(InputStream in) throws IOException {
/**
* Handle API error by either throwing it or by returning normally to retry.
*/
- void handleApiError(IOException e) throws IOException {
- int responseCode;
- try {
- responseCode = uc.getResponseCode();
- } catch (IOException e2) {
- // likely to be a network exception (e.g. SSLHandshakeException),
- // uc.getResponseCode() and any other getter on the response will cause an exception
- if (LOGGER.isLoggable(FINE))
- LOGGER.log(FINE,
- "Silently ignore exception retrieving response code for '" + uc.getURL() + "'"
- + " handling exception " + e,
- e);
- throw e;
+ IOException interpretApiError(IOException e, int responseCode, String message, URL url, int retries)
+ throws IOException {
+ // If we're already throwing a GHIOException, pass through
+ if (e instanceof GHIOException) {
+ return e;
}
InputStream es = wrapStream(uc.getErrorStream());
if (es != null) {
@@ -1043,37 +1063,19 @@ void handleApiError(IOException e) throws IOException {
String error = IOUtils.toString(es, StandardCharsets.UTF_8);
if (e instanceof FileNotFoundException) {
// pass through 404 Not Found to allow the caller to handle it intelligently
- e = (IOException) new GHFileNotFoundException(error).withResponseHeaderFields(uc).initCause(e);
- } else if (e instanceof HttpException) {
- HttpException http = (HttpException) e;
- e = new HttpException(error, http.getResponseCode(), http.getResponseMessage(), http.getUrl(), e);
+ e = new GHFileNotFoundException(error, e).withResponseHeaderFields(uc);
+ } else if (responseCode >= 0) {
+ e = new HttpException(error, responseCode, uc.getResponseMessage(), url.toString(), e);
} else {
- e = (IOException) new GHIOException(error).withResponseHeaderFields(uc).initCause(e);
+ e = new GHIOException(error).withResponseHeaderFields(uc);
}
} finally {
IOUtils.closeQuietly(es);
}
+ } else if (!(e instanceof FileNotFoundException)) {
+ e = new HttpException(responseCode, message, url.toString(), e);
}
- if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) // 401 Unauthorized == bad creds or OTP request
- // In the case of a user with 2fa enabled, a header with X-GitHub-OTP
- // will be returned indicating the user needs to respond with an otp
- if (uc.getHeaderField("X-GitHub-OTP") != null)
- throw (IOException) new GHOTPRequiredException().withResponseHeaderFields(uc).initCause(e);
- else
- throw e; // usually org.kohsuke.github.HttpException (which extends IOException)
-
- if ("0".equals(uc.getHeaderField("X-RateLimit-Remaining"))) {
- root.rateLimitHandler.onError(e, uc);
- return;
- }
-
- // Retry-After is not documented but apparently that field exists
- if (responseCode == HttpURLConnection.HTTP_FORBIDDEN && uc.getHeaderField("Retry-After") != null) {
- this.root.abuseLimitHandler.onError(e, uc);
- return;
- }
-
- throw e;
+ return e;
}
/**
diff --git a/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java b/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java
new file mode 100644
index 0000000000..8dc2aed4f5
--- /dev/null
+++ b/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java
@@ -0,0 +1,138 @@
+package org.kohsuke.github;
+
+import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
+import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+
+/**
+ * Test showing the behavior of OkHttpConnector with and without cache.
+ *
+ * Key take aways:
+ *
+ *
+ * - These tests are artificial and intended to highlight the differences in behavior between scenarios. However, the
+ * differences they indicate are stark.
+ * - Caching reduces rate limit consumption by at least a factor of two in even the simplest case.
+ * - The OkHttp cache is pretty smart and will often connect read and write requests made on the same client and
+ * invalidate caches.
+ * - Changes made outside the current client cause the OkHttp cache to return stale data. This is expected and correct
+ * behavior.
+ * - "max-age=0" addresses the problem of external changes by revalidating caches for each request. This produces the
+ * same number of requests as OkHttp without caching, but those requests only count towards the GitHub rate limit if
+ * data has changes.
+ *
+ *
+ * @author Liam Newman
+ */
+public class AbuseLimitHandlerTest extends AbstractGitHubWireMockTest {
+
+ public AbuseLimitHandlerTest() {
+ useDefaultGitHub = false;
+ }
+
+ @Override
+ protected WireMockConfiguration getWireMockOptions() {
+ return super.getWireMockOptions()
+ .extensions(ResponseTemplateTransformer.builder().global(true).maxCacheEntries(0L).build());
+ }
+
+ @Test
+ public void testHandler_Fail() throws Exception {
+ // Customized response that templates the date to keep things working
+ snapshotNotAllowed();
+
+ gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withAbuseLimitHandler(AbuseLimitHandler.FAIL)
+ .build();
+
+ gitHub.getMyself();
+ assertThat(mockGitHub.getRequestCount(), equalTo(1));
+
+ try {
+ getTempRepository();
+ fail();
+ } catch (Exception e) {
+ assertThat(e, instanceOf(IOException.class));
+ assertThat(e.getCause(), instanceOf(HttpException.class));
+ }
+
+ assertThat(mockGitHub.getRequestCount(), equalTo(2));
+
+ }
+
+ @Test
+ public void testHandler_HttpStatus_Fail() throws Exception {
+ // Customized response that templates the date to keep things working
+ snapshotNotAllowed();
+
+ gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withAbuseLimitHandler(AbuseLimitHandler.FAIL)
+ .build();
+
+ gitHub.getMyself();
+ assertThat(mockGitHub.getRequestCount(), equalTo(1));
+
+ try {
+ gitHub.createRequest()
+ .withUrlPath("/repos/" + GITHUB_API_TEST_ORG + "/temp-testHandler_Fail")
+ .fetchHttpStatusCode();
+
+ fail();
+ } catch (Exception e) {
+ assertThat(e, instanceOf(IOException.class));
+ assertThat(e.getCause(), instanceOf(HttpException.class));
+ }
+
+ assertThat(mockGitHub.getRequestCount(), equalTo(2));
+
+ }
+
+ @Test
+ public void testHandler_Wait() throws Exception {
+ // Customized response that templates the date to keep things working
+ snapshotNotAllowed();
+
+ gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withAbuseLimitHandler(AbuseLimitHandler.WAIT)
+ .build();
+
+ gitHub.getMyself();
+ assertThat(mockGitHub.getRequestCount(), equalTo(1));
+
+ getTempRepository();
+ assertThat(mockGitHub.getRequestCount(), equalTo(3));
+ }
+
+ @Test
+ public void testHandler_WaitStuck() throws Exception {
+ // Customized response that templates the date to keep things working
+ snapshotNotAllowed();
+
+ gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withRateLimitHandler(new RateLimitHandler() {
+ @Override
+ public void onError(IOException e, HttpURLConnection uc) throws IOException {
+ }
+ })
+ .build();
+
+ gitHub.getMyself();
+ assertThat(mockGitHub.getRequestCount(), equalTo(1));
+
+ try {
+ getTempRepository();
+ fail();
+ } catch (Exception e) {
+ assertThat(e, instanceOf(GHIOException.class));
+ }
+
+ assertThat(mockGitHub.getRequestCount(), equalTo(4));
+ }
+
+}
diff --git a/src/test/java/org/kohsuke/github/RateLimitHandlerTest.java b/src/test/java/org/kohsuke/github/RateLimitHandlerTest.java
new file mode 100644
index 0000000000..1810ae780c
--- /dev/null
+++ b/src/test/java/org/kohsuke/github/RateLimitHandlerTest.java
@@ -0,0 +1,138 @@
+package org.kohsuke.github;
+
+import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
+import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+
+/**
+ * Test showing the behavior of OkHttpConnector with and without cache.
+ *
+ * Key take aways:
+ *
+ *
+ * - These tests are artificial and intended to highlight the differences in behavior between scenarios. However, the
+ * differences they indicate are stark.
+ * - Caching reduces rate limit consumption by at least a factor of two in even the simplest case.
+ * - The OkHttp cache is pretty smart and will often connect read and write requests made on the same client and
+ * invalidate caches.
+ * - Changes made outside the current client cause the OkHttp cache to return stale data. This is expected and correct
+ * behavior.
+ * - "max-age=0" addresses the problem of external changes by revalidating caches for each request. This produces the
+ * same number of requests as OkHttp without caching, but those requests only count towards the GitHub rate limit if
+ * data has changes.
+ *
+ *
+ * @author Liam Newman
+ */
+public class RateLimitHandlerTest extends AbstractGitHubWireMockTest {
+
+ public RateLimitHandlerTest() {
+ useDefaultGitHub = false;
+ }
+
+ @Override
+ protected WireMockConfiguration getWireMockOptions() {
+ return super.getWireMockOptions()
+ .extensions(ResponseTemplateTransformer.builder().global(true).maxCacheEntries(0L).build());
+ }
+
+ @Test
+ public void testHandler_Fail() throws Exception {
+ // Customized response that templates the date to keep things working
+ snapshotNotAllowed();
+
+ gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withRateLimitHandler(RateLimitHandler.FAIL)
+ .build();
+
+ gitHub.getMyself();
+ assertThat(mockGitHub.getRequestCount(), equalTo(1));
+
+ try {
+ getTempRepository();
+ fail();
+ } catch (Exception e) {
+ assertThat(e, instanceOf(IOException.class));
+ assertThat(e.getCause(), instanceOf(HttpException.class));
+ }
+
+ assertThat(mockGitHub.getRequestCount(), equalTo(2));
+
+ }
+
+ @Test
+ public void testHandler_HttpStatus_Fail() throws Exception {
+ // Customized response that templates the date to keep things working
+ snapshotNotAllowed();
+
+ gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withRateLimitHandler(RateLimitHandler.FAIL)
+ .build();
+
+ gitHub.getMyself();
+ assertThat(mockGitHub.getRequestCount(), equalTo(1));
+
+ try {
+ gitHub.createRequest()
+ .withUrlPath("/repos/" + GITHUB_API_TEST_ORG + "/temp-testHandler_Fail")
+ .fetchHttpStatusCode();
+
+ fail();
+ } catch (Exception e) {
+ assertThat(e, instanceOf(IOException.class));
+ assertThat(e.getCause(), instanceOf(HttpException.class));
+ }
+
+ assertThat(mockGitHub.getRequestCount(), equalTo(2));
+
+ }
+
+ @Test
+ public void testHandler_Wait() throws Exception {
+ // Customized response that templates the date to keep things working
+ snapshotNotAllowed();
+
+ gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withRateLimitHandler(RateLimitHandler.WAIT)
+ .build();
+
+ gitHub.getMyself();
+ assertThat(mockGitHub.getRequestCount(), equalTo(1));
+
+ getTempRepository();
+ assertThat(mockGitHub.getRequestCount(), equalTo(3));
+ }
+
+ @Test
+ public void testHandler_WaitStuck() throws Exception {
+ // Customized response that templates the date to keep things working
+ snapshotNotAllowed();
+
+ gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withRateLimitHandler(new RateLimitHandler() {
+ @Override
+ public void onError(IOException e, HttpURLConnection uc) throws IOException {
+ }
+ })
+ .build();
+
+ gitHub.getMyself();
+ assertThat(mockGitHub.getRequestCount(), equalTo(1));
+
+ try {
+ getTempRepository();
+ fail();
+ } catch (Exception e) {
+ assertThat(e, instanceOf(GHIOException.class));
+ }
+
+ assertThat(mockGitHub.getRequestCount(), equalTo(4));
+ }
+
+}
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
new file mode 100644
index 0000000000..e450d4f91f
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
@@ -0,0 +1,126 @@
+{
+ "id": 238757196,
+ "node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
+ "name": "temp-testHandler_Fail",
+ "full_name": "github-api-test-org/temp-testHandler_Fail",
+ "private": false,
+ "owner": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
+ "description": "A test repository for testing the github-api project: temp-testHandler_Fail",
+ "fork": false,
+ "url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail",
+ "forks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/forks",
+ "keys_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/teams",
+ "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/hooks",
+ "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/events",
+ "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/tags",
+ "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/languages",
+ "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/stargazers",
+ "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contributors",
+ "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscribers",
+ "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscription",
+ "commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/merges",
+ "archive_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/downloads",
+ "issues_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/labels{/name}",
+ "releases_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/deployments",
+ "created_at": "2020-02-06T18:33:39Z",
+ "updated_at": "2020-02-06T18:33:43Z",
+ "pushed_at": "2020-02-06T18:33:41Z",
+ "git_url": "git://github.com/github-api-test-org/temp-testHandler_Fail.git",
+ "ssh_url": "git@github.com:github-api-test-org/temp-testHandler_Fail.git",
+ "clone_url": "https://github.com/github-api-test-org/temp-testHandler_Fail.git",
+ "svn_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
+ "homepage": "http://github-api.kohsuke.org/",
+ "size": 0,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": true,
+ "has_pages": false,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 0,
+ "license": null,
+ "forks": 0,
+ "open_issues": 0,
+ "watchers": 0,
+ "default_branch": "master",
+ "permissions": {
+ "admin": true,
+ "push": true,
+ "pull": true
+ },
+ "temp_clone_token": "",
+ "allow_squash_merge": true,
+ "allow_merge_commit": true,
+ "allow_rebase_merge": true,
+ "delete_branch_on_merge": false,
+ "organization": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "network_count": 0,
+ "subscribers_count": 6
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
new file mode 100644
index 0000000000..467313f149
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
@@ -0,0 +1,45 @@
+{
+ "login": "bitwiseman",
+ "id": 1958953,
+ "node_id": "MDQ6VXNlcjE5NTg5NTM=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/bitwiseman",
+ "html_url": "https://github.com/bitwiseman",
+ "followers_url": "https://api.github.com/users/bitwiseman/followers",
+ "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
+ "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
+ "organizations_url": "https://api.github.com/users/bitwiseman/orgs",
+ "repos_url": "https://api.github.com/users/bitwiseman/repos",
+ "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/bitwiseman/received_events",
+ "type": "User",
+ "site_admin": false,
+ "name": "Liam Newman",
+ "company": "Cloudbees, Inc.",
+ "blog": "",
+ "location": "Seattle, WA, USA",
+ "email": "bitwiseman@gmail.com",
+ "hireable": null,
+ "bio": "https://twitter.com/bitwiseman",
+ "public_repos": 181,
+ "public_gists": 7,
+ "followers": 146,
+ "following": 9,
+ "created_at": "2012-07-11T20:38:33Z",
+ "updated_at": "2020-02-06T17:29:39Z",
+ "private_gists": 8,
+ "total_private_repos": 10,
+ "owned_private_repos": 0,
+ "disk_usage": 33697,
+ "collaborators": 0,
+ "two_factor_authentication": true,
+ "plan": {
+ "name": "free",
+ "space": 976562499,
+ "collaborators": 0,
+ "private_repos": 10000
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
new file mode 100644
index 0000000000..5d27eff187
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
@@ -0,0 +1,52 @@
+{
+ "id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "name": "repos_github-api-test-org_temp-testratelimithandler_fail",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Fail",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 403,
+ "body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "403 Forbidden",
+ "Retry-After": "30",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4000",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
+ }
+ },
+ "uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
+ "requiredScenarioState": "Started",
+ "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
+ "insertionIndex": 2
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
new file mode 100644
index 0000000000..ce5bf4e38c
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
@@ -0,0 +1,50 @@
+{
+ "id": "574da117-6845-46d8-b2c1-4415546ca670",
+ "name": "repos_github-api-test-org_temp-testratelimithandler_fail",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Fail",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4922",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
+ }
+ },
+ "uuid": "574da117-6845-46d8-b2c1-4415546ca670",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
+ "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
+ "insertionIndex": 3
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json
new file mode 100644
index 0000000000..65ea20d5f0
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json
@@ -0,0 +1,48 @@
+{
+ "id": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "name": "user",
+ "request": {
+ "url": "/user",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json",
+ "headers": {
+ "Date": "Thu, 06 Feb 2020 18:33:32 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4930",
+ "X-RateLimit-Reset": "1581014122",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"1cb30f031c67c499473b3aad01c7f7a5\"",
+ "Last-Modified": "Thu, 06 Feb 2020 17:29:39 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F884:4E941:5E3C5BFC"
+ }
+ },
+ "uuid": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "persistent": true,
+ "insertionIndex": 1
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
new file mode 100644
index 0000000000..e450d4f91f
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
@@ -0,0 +1,126 @@
+{
+ "id": 238757196,
+ "node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
+ "name": "temp-testHandler_Fail",
+ "full_name": "github-api-test-org/temp-testHandler_Fail",
+ "private": false,
+ "owner": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
+ "description": "A test repository for testing the github-api project: temp-testHandler_Fail",
+ "fork": false,
+ "url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail",
+ "forks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/forks",
+ "keys_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/teams",
+ "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/hooks",
+ "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/events",
+ "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/tags",
+ "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/languages",
+ "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/stargazers",
+ "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contributors",
+ "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscribers",
+ "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscription",
+ "commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/merges",
+ "archive_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/downloads",
+ "issues_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/labels{/name}",
+ "releases_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/deployments",
+ "created_at": "2020-02-06T18:33:39Z",
+ "updated_at": "2020-02-06T18:33:43Z",
+ "pushed_at": "2020-02-06T18:33:41Z",
+ "git_url": "git://github.com/github-api-test-org/temp-testHandler_Fail.git",
+ "ssh_url": "git@github.com:github-api-test-org/temp-testHandler_Fail.git",
+ "clone_url": "https://github.com/github-api-test-org/temp-testHandler_Fail.git",
+ "svn_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
+ "homepage": "http://github-api.kohsuke.org/",
+ "size": 0,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": true,
+ "has_pages": false,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 0,
+ "license": null,
+ "forks": 0,
+ "open_issues": 0,
+ "watchers": 0,
+ "default_branch": "master",
+ "permissions": {
+ "admin": true,
+ "push": true,
+ "pull": true
+ },
+ "temp_clone_token": "",
+ "allow_squash_merge": true,
+ "allow_merge_commit": true,
+ "allow_rebase_merge": true,
+ "delete_branch_on_merge": false,
+ "organization": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "network_count": 0,
+ "subscribers_count": 6
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
new file mode 100644
index 0000000000..467313f149
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
@@ -0,0 +1,45 @@
+{
+ "login": "bitwiseman",
+ "id": 1958953,
+ "node_id": "MDQ6VXNlcjE5NTg5NTM=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/bitwiseman",
+ "html_url": "https://github.com/bitwiseman",
+ "followers_url": "https://api.github.com/users/bitwiseman/followers",
+ "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
+ "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
+ "organizations_url": "https://api.github.com/users/bitwiseman/orgs",
+ "repos_url": "https://api.github.com/users/bitwiseman/repos",
+ "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/bitwiseman/received_events",
+ "type": "User",
+ "site_admin": false,
+ "name": "Liam Newman",
+ "company": "Cloudbees, Inc.",
+ "blog": "",
+ "location": "Seattle, WA, USA",
+ "email": "bitwiseman@gmail.com",
+ "hireable": null,
+ "bio": "https://twitter.com/bitwiseman",
+ "public_repos": 181,
+ "public_gists": 7,
+ "followers": 146,
+ "following": 9,
+ "created_at": "2012-07-11T20:38:33Z",
+ "updated_at": "2020-02-06T17:29:39Z",
+ "private_gists": 8,
+ "total_private_repos": 10,
+ "owned_private_repos": 0,
+ "disk_usage": 33697,
+ "collaborators": 0,
+ "two_factor_authentication": true,
+ "plan": {
+ "name": "free",
+ "space": 976562499,
+ "collaborators": 0,
+ "private_repos": 10000
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
new file mode 100644
index 0000000000..5d27eff187
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
@@ -0,0 +1,52 @@
+{
+ "id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "name": "repos_github-api-test-org_temp-testratelimithandler_fail",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Fail",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 403,
+ "body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "403 Forbidden",
+ "Retry-After": "30",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4000",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
+ }
+ },
+ "uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
+ "requiredScenarioState": "Started",
+ "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
+ "insertionIndex": 2
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
new file mode 100644
index 0000000000..ce5bf4e38c
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
@@ -0,0 +1,50 @@
+{
+ "id": "574da117-6845-46d8-b2c1-4415546ca670",
+ "name": "repos_github-api-test-org_temp-testratelimithandler_fail",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Fail",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4922",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
+ }
+ },
+ "uuid": "574da117-6845-46d8-b2c1-4415546ca670",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
+ "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
+ "insertionIndex": 3
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json
new file mode 100644
index 0000000000..65ea20d5f0
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json
@@ -0,0 +1,48 @@
+{
+ "id": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "name": "user",
+ "request": {
+ "url": "/user",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json",
+ "headers": {
+ "Date": "Thu, 06 Feb 2020 18:33:32 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4930",
+ "X-RateLimit-Reset": "1581014122",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"1cb30f031c67c499473b3aad01c7f7a5\"",
+ "Last-Modified": "Thu, 06 Feb 2020 17:29:39 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F884:4E941:5E3C5BFC"
+ }
+ },
+ "uuid": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "persistent": true,
+ "insertionIndex": 1
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
new file mode 100644
index 0000000000..636f760eb6
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
@@ -0,0 +1,126 @@
+{
+ "id": 238757196,
+ "node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
+ "name": "temp-testHandler_Wait",
+ "full_name": "github-api-test-org/temp-testHandler_Wait",
+ "private": false,
+ "owner": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/github-api-test-org/temp-testHandler_Wait",
+ "description": "A test repository for testing the github-api project: temp-testHandler_Wait",
+ "fork": false,
+ "url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait",
+ "forks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/forks",
+ "keys_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/teams",
+ "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/hooks",
+ "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/events",
+ "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/tags",
+ "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/languages",
+ "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/stargazers",
+ "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/contributors",
+ "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/subscribers",
+ "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/subscription",
+ "commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/merges",
+ "archive_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/downloads",
+ "issues_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/labels{/name}",
+ "releases_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/deployments",
+ "created_at": "2020-02-06T18:33:39Z",
+ "updated_at": "2020-02-06T18:33:43Z",
+ "pushed_at": "2020-02-06T18:33:41Z",
+ "git_url": "git://github.com/github-api-test-org/temp-testHandler_Wait.git",
+ "ssh_url": "git@github.com:github-api-test-org/temp-testHandler_Wait.git",
+ "clone_url": "https://github.com/github-api-test-org/temp-testHandler_Wait.git",
+ "svn_url": "https://github.com/github-api-test-org/temp-testHandler_Wait",
+ "homepage": "http://github-api.kohsuke.org/",
+ "size": 0,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": true,
+ "has_pages": false,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 0,
+ "license": null,
+ "forks": 0,
+ "open_issues": 0,
+ "watchers": 0,
+ "default_branch": "master",
+ "permissions": {
+ "admin": true,
+ "push": true,
+ "pull": true
+ },
+ "temp_clone_token": "",
+ "allow_squash_merge": true,
+ "allow_merge_commit": true,
+ "allow_rebase_merge": true,
+ "delete_branch_on_merge": false,
+ "organization": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "network_count": 0,
+ "subscribers_count": 6
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
new file mode 100644
index 0000000000..467313f149
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
@@ -0,0 +1,45 @@
+{
+ "login": "bitwiseman",
+ "id": 1958953,
+ "node_id": "MDQ6VXNlcjE5NTg5NTM=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/bitwiseman",
+ "html_url": "https://github.com/bitwiseman",
+ "followers_url": "https://api.github.com/users/bitwiseman/followers",
+ "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
+ "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
+ "organizations_url": "https://api.github.com/users/bitwiseman/orgs",
+ "repos_url": "https://api.github.com/users/bitwiseman/repos",
+ "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/bitwiseman/received_events",
+ "type": "User",
+ "site_admin": false,
+ "name": "Liam Newman",
+ "company": "Cloudbees, Inc.",
+ "blog": "",
+ "location": "Seattle, WA, USA",
+ "email": "bitwiseman@gmail.com",
+ "hireable": null,
+ "bio": "https://twitter.com/bitwiseman",
+ "public_repos": 181,
+ "public_gists": 7,
+ "followers": 146,
+ "following": 9,
+ "created_at": "2012-07-11T20:38:33Z",
+ "updated_at": "2020-02-06T17:29:39Z",
+ "private_gists": 8,
+ "total_private_repos": 10,
+ "owned_private_repos": 0,
+ "disk_usage": 33697,
+ "collaborators": 0,
+ "two_factor_authentication": true,
+ "plan": {
+ "name": "free",
+ "space": 976562499,
+ "collaborators": 0,
+ "private_repos": 10000
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
new file mode 100644
index 0000000000..b7e939c4e8
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
@@ -0,0 +1,52 @@
+{
+ "id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "name": "repos_github-api-test-org_temp-testHandler_Wait",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Wait",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 403,
+ "body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "403 Forbidden",
+ "Retry-After": "2",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4000",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
+ }
+ },
+ "uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait",
+ "requiredScenarioState": "Started",
+ "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait-2",
+ "insertionIndex": 2
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
new file mode 100644
index 0000000000..53f1e99926
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
@@ -0,0 +1,50 @@
+{
+ "id": "574da117-6845-46d8-b2c1-4415546ca670",
+ "name": "repos_github-api-test-org_temp-testHandler_Wait",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Wait",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4922",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
+ }
+ },
+ "uuid": "574da117-6845-46d8-b2c1-4415546ca670",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait",
+ "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait-2",
+ "insertionIndex": 3
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json
new file mode 100644
index 0000000000..65ea20d5f0
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json
@@ -0,0 +1,48 @@
+{
+ "id": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "name": "user",
+ "request": {
+ "url": "/user",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json",
+ "headers": {
+ "Date": "Thu, 06 Feb 2020 18:33:32 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4930",
+ "X-RateLimit-Reset": "1581014122",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"1cb30f031c67c499473b3aad01c7f7a5\"",
+ "Last-Modified": "Thu, 06 Feb 2020 17:29:39 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F884:4E941:5E3C5BFC"
+ }
+ },
+ "uuid": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "persistent": true,
+ "insertionIndex": 1
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
new file mode 100644
index 0000000000..467313f149
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
@@ -0,0 +1,45 @@
+{
+ "login": "bitwiseman",
+ "id": 1958953,
+ "node_id": "MDQ6VXNlcjE5NTg5NTM=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/bitwiseman",
+ "html_url": "https://github.com/bitwiseman",
+ "followers_url": "https://api.github.com/users/bitwiseman/followers",
+ "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
+ "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
+ "organizations_url": "https://api.github.com/users/bitwiseman/orgs",
+ "repos_url": "https://api.github.com/users/bitwiseman/repos",
+ "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/bitwiseman/received_events",
+ "type": "User",
+ "site_admin": false,
+ "name": "Liam Newman",
+ "company": "Cloudbees, Inc.",
+ "blog": "",
+ "location": "Seattle, WA, USA",
+ "email": "bitwiseman@gmail.com",
+ "hireable": null,
+ "bio": "https://twitter.com/bitwiseman",
+ "public_repos": 181,
+ "public_gists": 7,
+ "followers": 146,
+ "following": 9,
+ "created_at": "2012-07-11T20:38:33Z",
+ "updated_at": "2020-02-06T17:29:39Z",
+ "private_gists": 8,
+ "total_private_repos": 10,
+ "owned_private_repos": 0,
+ "disk_usage": 33697,
+ "collaborators": 0,
+ "two_factor_authentication": true,
+ "plan": {
+ "name": "free",
+ "space": 976562499,
+ "collaborators": 0,
+ "private_repos": 10000
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
new file mode 100644
index 0000000000..3455eb9b45
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
@@ -0,0 +1,49 @@
+{
+ "id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "name": "repos_github-api-test-org_temp-testHandler_WaitStuck",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_WaitStuck",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 403,
+ "body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "403 Forbidden",
+ "Retry-After": "3",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4000",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
+ }
+ },
+ "uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "persistent": true,
+ "insertionIndex": 2
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json
new file mode 100644
index 0000000000..65ea20d5f0
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json
@@ -0,0 +1,48 @@
+{
+ "id": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "name": "user",
+ "request": {
+ "url": "/user",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json",
+ "headers": {
+ "Date": "Thu, 06 Feb 2020 18:33:32 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4930",
+ "X-RateLimit-Reset": "1581014122",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"1cb30f031c67c499473b3aad01c7f7a5\"",
+ "Last-Modified": "Thu, 06 Feb 2020 17:29:39 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F884:4E941:5E3C5BFC"
+ }
+ },
+ "uuid": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "persistent": true,
+ "insertionIndex": 1
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
new file mode 100644
index 0000000000..e450d4f91f
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
@@ -0,0 +1,126 @@
+{
+ "id": 238757196,
+ "node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
+ "name": "temp-testHandler_Fail",
+ "full_name": "github-api-test-org/temp-testHandler_Fail",
+ "private": false,
+ "owner": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
+ "description": "A test repository for testing the github-api project: temp-testHandler_Fail",
+ "fork": false,
+ "url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail",
+ "forks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/forks",
+ "keys_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/teams",
+ "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/hooks",
+ "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/events",
+ "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/tags",
+ "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/languages",
+ "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/stargazers",
+ "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contributors",
+ "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscribers",
+ "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscription",
+ "commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/merges",
+ "archive_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/downloads",
+ "issues_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/labels{/name}",
+ "releases_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/deployments",
+ "created_at": "2020-02-06T18:33:39Z",
+ "updated_at": "2020-02-06T18:33:43Z",
+ "pushed_at": "2020-02-06T18:33:41Z",
+ "git_url": "git://github.com/github-api-test-org/temp-testHandler_Fail.git",
+ "ssh_url": "git@github.com:github-api-test-org/temp-testHandler_Fail.git",
+ "clone_url": "https://github.com/github-api-test-org/temp-testHandler_Fail.git",
+ "svn_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
+ "homepage": "http://github-api.kohsuke.org/",
+ "size": 0,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": true,
+ "has_pages": false,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 0,
+ "license": null,
+ "forks": 0,
+ "open_issues": 0,
+ "watchers": 0,
+ "default_branch": "master",
+ "permissions": {
+ "admin": true,
+ "push": true,
+ "pull": true
+ },
+ "temp_clone_token": "",
+ "allow_squash_merge": true,
+ "allow_merge_commit": true,
+ "allow_rebase_merge": true,
+ "delete_branch_on_merge": false,
+ "organization": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "network_count": 0,
+ "subscribers_count": 6
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
new file mode 100644
index 0000000000..467313f149
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
@@ -0,0 +1,45 @@
+{
+ "login": "bitwiseman",
+ "id": 1958953,
+ "node_id": "MDQ6VXNlcjE5NTg5NTM=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/bitwiseman",
+ "html_url": "https://github.com/bitwiseman",
+ "followers_url": "https://api.github.com/users/bitwiseman/followers",
+ "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
+ "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
+ "organizations_url": "https://api.github.com/users/bitwiseman/orgs",
+ "repos_url": "https://api.github.com/users/bitwiseman/repos",
+ "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/bitwiseman/received_events",
+ "type": "User",
+ "site_admin": false,
+ "name": "Liam Newman",
+ "company": "Cloudbees, Inc.",
+ "blog": "",
+ "location": "Seattle, WA, USA",
+ "email": "bitwiseman@gmail.com",
+ "hireable": null,
+ "bio": "https://twitter.com/bitwiseman",
+ "public_repos": 181,
+ "public_gists": 7,
+ "followers": 146,
+ "following": 9,
+ "created_at": "2012-07-11T20:38:33Z",
+ "updated_at": "2020-02-06T17:29:39Z",
+ "private_gists": 8,
+ "total_private_repos": 10,
+ "owned_private_repos": 0,
+ "disk_usage": 33697,
+ "collaborators": 0,
+ "two_factor_authentication": true,
+ "plan": {
+ "name": "free",
+ "space": 976562499,
+ "collaborators": 0,
+ "private_repos": 10000
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
new file mode 100644
index 0000000000..9a3217193a
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
@@ -0,0 +1,51 @@
+{
+ "id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "name": "repos_github-api-test-org_temp-testratelimithandler_fail",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Fail",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 403,
+ "body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "403 Forbidden",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "0",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
+ }
+ },
+ "uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
+ "requiredScenarioState": "Started",
+ "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
+ "insertionIndex": 2
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
new file mode 100644
index 0000000000..ce5bf4e38c
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
@@ -0,0 +1,50 @@
+{
+ "id": "574da117-6845-46d8-b2c1-4415546ca670",
+ "name": "repos_github-api-test-org_temp-testratelimithandler_fail",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Fail",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4922",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
+ }
+ },
+ "uuid": "574da117-6845-46d8-b2c1-4415546ca670",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
+ "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
+ "insertionIndex": 3
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json
new file mode 100644
index 0000000000..65ea20d5f0
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json
@@ -0,0 +1,48 @@
+{
+ "id": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "name": "user",
+ "request": {
+ "url": "/user",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json",
+ "headers": {
+ "Date": "Thu, 06 Feb 2020 18:33:32 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4930",
+ "X-RateLimit-Reset": "1581014122",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"1cb30f031c67c499473b3aad01c7f7a5\"",
+ "Last-Modified": "Thu, 06 Feb 2020 17:29:39 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F884:4E941:5E3C5BFC"
+ }
+ },
+ "uuid": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "persistent": true,
+ "insertionIndex": 1
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
new file mode 100644
index 0000000000..e450d4f91f
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
@@ -0,0 +1,126 @@
+{
+ "id": 238757196,
+ "node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
+ "name": "temp-testHandler_Fail",
+ "full_name": "github-api-test-org/temp-testHandler_Fail",
+ "private": false,
+ "owner": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
+ "description": "A test repository for testing the github-api project: temp-testHandler_Fail",
+ "fork": false,
+ "url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail",
+ "forks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/forks",
+ "keys_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/teams",
+ "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/hooks",
+ "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/events",
+ "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/tags",
+ "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/languages",
+ "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/stargazers",
+ "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contributors",
+ "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscribers",
+ "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/subscription",
+ "commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/merges",
+ "archive_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/downloads",
+ "issues_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/labels{/name}",
+ "releases_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Fail/deployments",
+ "created_at": "2020-02-06T18:33:39Z",
+ "updated_at": "2020-02-06T18:33:43Z",
+ "pushed_at": "2020-02-06T18:33:41Z",
+ "git_url": "git://github.com/github-api-test-org/temp-testHandler_Fail.git",
+ "ssh_url": "git@github.com:github-api-test-org/temp-testHandler_Fail.git",
+ "clone_url": "https://github.com/github-api-test-org/temp-testHandler_Fail.git",
+ "svn_url": "https://github.com/github-api-test-org/temp-testHandler_Fail",
+ "homepage": "http://github-api.kohsuke.org/",
+ "size": 0,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": true,
+ "has_pages": false,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 0,
+ "license": null,
+ "forks": 0,
+ "open_issues": 0,
+ "watchers": 0,
+ "default_branch": "master",
+ "permissions": {
+ "admin": true,
+ "push": true,
+ "pull": true
+ },
+ "temp_clone_token": "",
+ "allow_squash_merge": true,
+ "allow_merge_commit": true,
+ "allow_rebase_merge": true,
+ "delete_branch_on_merge": false,
+ "organization": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "network_count": 0,
+ "subscribers_count": 6
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
new file mode 100644
index 0000000000..467313f149
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
@@ -0,0 +1,45 @@
+{
+ "login": "bitwiseman",
+ "id": 1958953,
+ "node_id": "MDQ6VXNlcjE5NTg5NTM=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/bitwiseman",
+ "html_url": "https://github.com/bitwiseman",
+ "followers_url": "https://api.github.com/users/bitwiseman/followers",
+ "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
+ "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
+ "organizations_url": "https://api.github.com/users/bitwiseman/orgs",
+ "repos_url": "https://api.github.com/users/bitwiseman/repos",
+ "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/bitwiseman/received_events",
+ "type": "User",
+ "site_admin": false,
+ "name": "Liam Newman",
+ "company": "Cloudbees, Inc.",
+ "blog": "",
+ "location": "Seattle, WA, USA",
+ "email": "bitwiseman@gmail.com",
+ "hireable": null,
+ "bio": "https://twitter.com/bitwiseman",
+ "public_repos": 181,
+ "public_gists": 7,
+ "followers": 146,
+ "following": 9,
+ "created_at": "2012-07-11T20:38:33Z",
+ "updated_at": "2020-02-06T17:29:39Z",
+ "private_gists": 8,
+ "total_private_repos": 10,
+ "owned_private_repos": 0,
+ "disk_usage": 33697,
+ "collaborators": 0,
+ "two_factor_authentication": true,
+ "plan": {
+ "name": "free",
+ "space": 976562499,
+ "collaborators": 0,
+ "private_repos": 10000
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
new file mode 100644
index 0000000000..9a3217193a
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
@@ -0,0 +1,51 @@
+{
+ "id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "name": "repos_github-api-test-org_temp-testratelimithandler_fail",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Fail",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 403,
+ "body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "403 Forbidden",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "0",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
+ }
+ },
+ "uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
+ "requiredScenarioState": "Started",
+ "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
+ "insertionIndex": 2
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
new file mode 100644
index 0000000000..ce5bf4e38c
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
@@ -0,0 +1,50 @@
+{
+ "id": "574da117-6845-46d8-b2c1-4415546ca670",
+ "name": "repos_github-api-test-org_temp-testratelimithandler_fail",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Fail",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4922",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
+ }
+ },
+ "uuid": "574da117-6845-46d8-b2c1-4415546ca670",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail",
+ "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Fail-2",
+ "insertionIndex": 3
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json
new file mode 100644
index 0000000000..65ea20d5f0
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json
@@ -0,0 +1,48 @@
+{
+ "id": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "name": "user",
+ "request": {
+ "url": "/user",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json",
+ "headers": {
+ "Date": "Thu, 06 Feb 2020 18:33:32 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4930",
+ "X-RateLimit-Reset": "1581014122",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"1cb30f031c67c499473b3aad01c7f7a5\"",
+ "Last-Modified": "Thu, 06 Feb 2020 17:29:39 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F884:4E941:5E3C5BFC"
+ }
+ },
+ "uuid": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "persistent": true,
+ "insertionIndex": 1
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
new file mode 100644
index 0000000000..636f760eb6
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/__files/repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json
@@ -0,0 +1,126 @@
+{
+ "id": 238757196,
+ "node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=",
+ "name": "temp-testHandler_Wait",
+ "full_name": "github-api-test-org/temp-testHandler_Wait",
+ "private": false,
+ "owner": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/github-api-test-org/temp-testHandler_Wait",
+ "description": "A test repository for testing the github-api project: temp-testHandler_Wait",
+ "fork": false,
+ "url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait",
+ "forks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/forks",
+ "keys_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/teams",
+ "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/hooks",
+ "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/events",
+ "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/tags",
+ "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/languages",
+ "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/stargazers",
+ "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/contributors",
+ "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/subscribers",
+ "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/subscription",
+ "commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/merges",
+ "archive_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/downloads",
+ "issues_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/labels{/name}",
+ "releases_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testHandler_Wait/deployments",
+ "created_at": "2020-02-06T18:33:39Z",
+ "updated_at": "2020-02-06T18:33:43Z",
+ "pushed_at": "2020-02-06T18:33:41Z",
+ "git_url": "git://github.com/github-api-test-org/temp-testHandler_Wait.git",
+ "ssh_url": "git@github.com:github-api-test-org/temp-testHandler_Wait.git",
+ "clone_url": "https://github.com/github-api-test-org/temp-testHandler_Wait.git",
+ "svn_url": "https://github.com/github-api-test-org/temp-testHandler_Wait",
+ "homepage": "http://github-api.kohsuke.org/",
+ "size": 0,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": true,
+ "has_pages": false,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 0,
+ "license": null,
+ "forks": 0,
+ "open_issues": 0,
+ "watchers": 0,
+ "default_branch": "master",
+ "permissions": {
+ "admin": true,
+ "push": true,
+ "pull": true
+ },
+ "temp_clone_token": "",
+ "allow_squash_merge": true,
+ "allow_merge_commit": true,
+ "allow_rebase_merge": true,
+ "delete_branch_on_merge": false,
+ "organization": {
+ "login": "github-api-test-org",
+ "id": 7544739,
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/github-api-test-org",
+ "html_url": "https://github.com/github-api-test-org",
+ "followers_url": "https://api.github.com/users/github-api-test-org/followers",
+ "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
+ "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
+ "organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
+ "repos_url": "https://api.github.com/users/github-api-test-org/repos",
+ "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
+ "type": "Organization",
+ "site_admin": false
+ },
+ "network_count": 0,
+ "subscribers_count": 6
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
new file mode 100644
index 0000000000..467313f149
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
@@ -0,0 +1,45 @@
+{
+ "login": "bitwiseman",
+ "id": 1958953,
+ "node_id": "MDQ6VXNlcjE5NTg5NTM=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/bitwiseman",
+ "html_url": "https://github.com/bitwiseman",
+ "followers_url": "https://api.github.com/users/bitwiseman/followers",
+ "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
+ "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
+ "organizations_url": "https://api.github.com/users/bitwiseman/orgs",
+ "repos_url": "https://api.github.com/users/bitwiseman/repos",
+ "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/bitwiseman/received_events",
+ "type": "User",
+ "site_admin": false,
+ "name": "Liam Newman",
+ "company": "Cloudbees, Inc.",
+ "blog": "",
+ "location": "Seattle, WA, USA",
+ "email": "bitwiseman@gmail.com",
+ "hireable": null,
+ "bio": "https://twitter.com/bitwiseman",
+ "public_repos": 181,
+ "public_gists": 7,
+ "followers": 146,
+ "following": 9,
+ "created_at": "2012-07-11T20:38:33Z",
+ "updated_at": "2020-02-06T17:29:39Z",
+ "private_gists": 8,
+ "total_private_repos": 10,
+ "owned_private_repos": 0,
+ "disk_usage": 33697,
+ "collaborators": 0,
+ "two_factor_authentication": true,
+ "plan": {
+ "name": "free",
+ "space": 976562499,
+ "collaborators": 0,
+ "private_repos": 10000
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
new file mode 100644
index 0000000000..8f38ec6493
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
@@ -0,0 +1,51 @@
+{
+ "id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "name": "repos_github-api-test-org_temp-testHandler_Wait",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Wait",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 403,
+ "body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "403 Forbidden",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "0",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
+ }
+ },
+ "uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait",
+ "requiredScenarioState": "Started",
+ "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait-2",
+ "insertionIndex": 2
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
new file mode 100644
index 0000000000..53f1e99926
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json
@@ -0,0 +1,50 @@
+{
+ "id": "574da117-6845-46d8-b2c1-4415546ca670",
+ "name": "repos_github-api-test-org_temp-testHandler_Wait",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_Wait",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "repos_github-api-test-org_temp-testratelimithandler_fail-574da117-6845-46d8-b2c1-4415546ca670.json",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4922",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02"
+ }
+ },
+ "uuid": "574da117-6845-46d8-b2c1-4415546ca670",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait",
+ "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testHandler_Wait-2",
+ "insertionIndex": 3
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json
new file mode 100644
index 0000000000..65ea20d5f0
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json
@@ -0,0 +1,48 @@
+{
+ "id": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "name": "user",
+ "request": {
+ "url": "/user",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json",
+ "headers": {
+ "Date": "Thu, 06 Feb 2020 18:33:32 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4930",
+ "X-RateLimit-Reset": "1581014122",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"1cb30f031c67c499473b3aad01c7f7a5\"",
+ "Last-Modified": "Thu, 06 Feb 2020 17:29:39 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F884:4E941:5E3C5BFC"
+ }
+ },
+ "uuid": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "persistent": true,
+ "insertionIndex": 1
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
new file mode 100644
index 0000000000..467313f149
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/__files/user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json
@@ -0,0 +1,45 @@
+{
+ "login": "bitwiseman",
+ "id": 1958953,
+ "node_id": "MDQ6VXNlcjE5NTg5NTM=",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/bitwiseman",
+ "html_url": "https://github.com/bitwiseman",
+ "followers_url": "https://api.github.com/users/bitwiseman/followers",
+ "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
+ "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
+ "organizations_url": "https://api.github.com/users/bitwiseman/orgs",
+ "repos_url": "https://api.github.com/users/bitwiseman/repos",
+ "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/bitwiseman/received_events",
+ "type": "User",
+ "site_admin": false,
+ "name": "Liam Newman",
+ "company": "Cloudbees, Inc.",
+ "blog": "",
+ "location": "Seattle, WA, USA",
+ "email": "bitwiseman@gmail.com",
+ "hireable": null,
+ "bio": "https://twitter.com/bitwiseman",
+ "public_repos": 181,
+ "public_gists": 7,
+ "followers": 146,
+ "following": 9,
+ "created_at": "2012-07-11T20:38:33Z",
+ "updated_at": "2020-02-06T17:29:39Z",
+ "private_gists": 8,
+ "total_private_repos": 10,
+ "owned_private_repos": 0,
+ "disk_usage": 33697,
+ "collaborators": 0,
+ "two_factor_authentication": true,
+ "plan": {
+ "name": "free",
+ "space": 976562499,
+ "collaborators": 0,
+ "private_repos": 10000
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
new file mode 100644
index 0000000000..6933894525
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json
@@ -0,0 +1,48 @@
+{
+ "id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "name": "repos_github-api-test-org_temp-testHandler_WaitStuck",
+ "request": {
+ "url": "/repos/github-api-test-org/temp-testHandler_WaitStuck",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 403,
+ "body": "{\"message\":\"Must have push access to repository\",\"documentation_url\":\"https://developer.github.com/\"}",
+ "headers": {
+ "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "403 Forbidden",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "0",
+ "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"",
+ "Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC"
+ }
+ },
+ "uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261",
+ "persistent": true,
+ "insertionIndex": 2
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json
new file mode 100644
index 0000000000..65ea20d5f0
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json
@@ -0,0 +1,48 @@
+{
+ "id": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "name": "user",
+ "request": {
+ "url": "/user",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json",
+ "headers": {
+ "Date": "Thu, 06 Feb 2020 18:33:32 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Server": "GitHub.com",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4930",
+ "X-RateLimit-Reset": "1581014122",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding"
+ ],
+ "ETag": "W/\"1cb30f031c67c499473b3aad01c7f7a5\"",
+ "Last-Modified": "Thu, 06 Feb 2020 17:29:39 GMT",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
+ "Access-Control-Allow-Origin": "*",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "CC37:2605:3F884:4E941:5E3C5BFC"
+ }
+ },
+ "uuid": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2",
+ "persistent": true,
+ "insertionIndex": 1
+}
\ No newline at end of file