From ae2364682191900ba3db9f34af5a4f613fa1a3fa Mon Sep 17 00:00:00 2001
From: Henry Borasch <Henry.Borasch@sinc.de>
Date: Mon, 24 Apr 2023 09:42:44 +0200
Subject: [PATCH] 978: ignore proxy configuration when it is
 "localhost/127.0.0.1:0"

---
 .../dev/fitko/fitconnect/core/http/HttpClient.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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 b353d821c..e19e9b7b4 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;
     }
 
-- 
GitLab