Skip to content

Commit

Permalink
#82: Prevent infinite authentication loop within environment proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Pfotenhauer committed Apr 23, 2019
1 parent 9782f0e commit bb97b93
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,15 @@ private void configureClientWithTestEnvironment(okhttp3.OkHttpClient.Builder cli
public Request authenticate(Route route, Response response) throws IOException
{
String credential = Credentials.basic(proxyUsername, proxyPassword);
return response.request().newBuilder()
.header("Proxy-Authorization", credential)
.build();
Request request = response.request().newBuilder()
.header("Proxy-Authorization", credential)
.build();

if (response.code() == 407)
{
throw new RuntimeException("The proxy credentials configured for evironment are missing or incorrect.");
}
return request;
}
});
}
Expand Down

0 comments on commit bb97b93

Please sign in to comment.