diff --git a/core/src/main/java/dev/fitko/fitconnect/core/http/HttpClient.java b/core/src/main/java/dev/fitko/fitconnect/core/http/HttpClient.java index b353d821c77d31e7e721e21b6bdb246d3227a9fd..e19e9b7b461da6d329e32dcd13cdd72489fdbcf9 100644 --- a/core/src/main/java/dev/fitko/fitconnect/core/http/HttpClient.java +++ b/core/src/main/java/dev/fitko/fitconnect/core/http/HttpClient.java @@ -49,8 +49,14 @@ public class HttpClient { } public HttpClient(boolean throwExceptionsOnFailure, List<Interceptor> interceptors, Proxy proxy) { - LOGGER.info("Creating HttpClient with proxy configuration: {}", proxy); - this.httpClient = builderWithInterceptors(interceptors).proxy(proxy).build(); + + if (proxy.address().toString().equals("localhost/127.0.0.1:0")) { + LOGGER.info("Creating HttpClient without proxy configuration."); + this.httpClient = builderWithInterceptors(interceptors).build(); + } else { + LOGGER.info("Creating HttpClient with proxy configuration: {}", proxy); + this.httpClient = builderWithInterceptors(interceptors).proxy(proxy).build(); + } this.throwExceptionsOnFailure = throwExceptionsOnFailure; }