Skip to content

Commit 519431e

Browse files
committed
Fix weird constructs in the LoginTokenInterceptor, caused by refactoring
1 parent f178f0c commit 519431e

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

library/src/main/java/me/proxer/library/api/LoginTokenInterceptor.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Response intercept(final Chain chain) throws IOException {
6060
final Response response = chain.proceed(newRequestBuilder.build());
6161

6262
if (response.isSuccessful()) {
63-
if (handleResponse(response)) return response;
63+
handleResponse(response);
6464
}
6565

6666
return response;
@@ -69,7 +69,7 @@ public Response intercept(final Chain chain) throws IOException {
6969
}
7070
}
7171

72-
private boolean handleResponse(Response response) throws IOException {
72+
private void handleResponse(final Response response) throws IOException {
7373
final String responseBody = peekResponseBody(response);
7474
final Matcher errorMatcher = ERROR_PATTERN.matcher(responseBody);
7575
final HttpUrl url = response.request().url();
@@ -81,8 +81,6 @@ private boolean handleResponse(Response response) throws IOException {
8181
if (errorType != null && isLoginError(errorType)) {
8282
loginTokenManager.persist(null);
8383
}
84-
85-
return true;
8684
} else if (url.pathSegments().equals(LOGIN_PATH)) {
8785
final Matcher loginTokenMatcher = LOGIN_TOKEN_PATTERN.matcher(responseBody);
8886

@@ -94,11 +92,9 @@ private boolean handleResponse(Response response) throws IOException {
9492
} else if (url.pathSegments().equals(LOGOUT_PATH)) {
9593
loginTokenManager.persist(null);
9694
}
97-
98-
return false;
9995
}
10096

101-
private String peekResponseBody(Response response) throws IOException {
97+
private String peekResponseBody(final Response response) throws IOException {
10298
final ResponseBody safeBody = response.body();
10399

104100
return safeBody != null && safeBody.contentLength() > 0 ? response.peekBody(MAX_PEEK_BYTE_COUNT).string() : "";

0 commit comments

Comments
 (0)