Skip to content

Commit

Permalink
Return rate limit message instead of parsing error stream
Browse files Browse the repository at this point in the history
  • Loading branch information
lkorth committed Apr 22, 2016
1 parent a5f6e59 commit 2fe98d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ public void postsUnprocessableEntityExceptionOn422() throws IOException, Interru

@Test(timeout = 1000)
public void postsRateLimitExceptionOn429() throws IOException, InterruptedException {
HttpClient httpClient = clientWithExpectedResponse(429, "Too many requests");
HttpClient httpClient = clientWithExpectedResponse(429, "");

assertExceptionIsPosted(httpClient, RateLimitException.class, "Too many requests");
assertExceptionIsPosted(httpClient, RateLimitException.class, "You are being rate-limited. Please try again in a few minutes.");
}

@Test(timeout = 1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ protected String parseResponse(HttpURLConnection connection) throws Exception {
case 426: // HTTP_UPGRADE_REQUIRED
throw new UpgradeRequiredException(readStream(connection.getErrorStream(), gzip));
case 429: // HTTP_TOO_MANY_REQUESTS
throw new RateLimitException(readStream(connection.getErrorStream(), gzip));
throw new RateLimitException("You are being rate-limited. Please try again in a few minutes.");
case HTTP_INTERNAL_ERROR:
throw new ServerException(readStream(connection.getErrorStream(), gzip));
case HTTP_UNAVAILABLE:
Expand Down

0 comments on commit 2fe98d4

Please sign in to comment.