Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/edu/ksu/canvas/net/SimpleRestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ private void checkHeaders(ClassicHttpResponse httpResponse, HttpUriRequestBase r
LOG.error("User is not authorized to perform this action");
throw new UnauthorizedException();
}
if(statusCode == 403) {
if(statusCode == 429) {
LOG.error("Canvas has throttled this request. Requested URL: " + uri);
throw new ThrottlingException(extractErrorMessageFromResponse(httpResponse), String.valueOf(uri));
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/edu/ksu/canvas/net/SimpleRestClientUTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ void http401InvalidTokenThrowsException() throws Exception {
}

@Test
void http403ThrottlingThrowsException() throws Exception {
void http429ThrottlingThrowsException() throws Exception {
String url = "/throttledUrl";
//Using blank JSON because I haven't been able to observe this error so I don't know what payload it returns
registerUrlResponse(url, "/SampleJson/BlankResponse.json", 403, Collections.emptyMap());
registerUrlResponse(url, "/SampleJson/BlankResponse.json", 429, Collections.emptyMap());

assertThrows(ThrottlingException.class, () -> {
restClient.sendApiGet(emptyAdminToken, baseUrl + url, 100, 100);
Expand Down
Loading