use of retrofit2.http.Header in project Varis-Android by dkhmelenko.
the class AuthPresenter method isTwoFactorAuthRequired.
private boolean isTwoFactorAuthRequired(HttpException exception) {
Response response = exception.response();
boolean twoFactorAuthRequired = false;
for (String header : response.headers().names()) {
if (GithubApiService.TWO_FACTOR_HEADER.equals(header)) {
twoFactorAuthRequired = true;
break;
}
}
return response.code() == HttpURLConnection.HTTP_UNAUTHORIZED && twoFactorAuthRequired;
}
Aggregations