diff --git a/src/main/java/reactor/ipc/netty/http/client/HttpClientOptions.java b/src/main/java/reactor/ipc/netty/http/client/HttpClientOptions.java index a5c0a6bf24..af6b129ce0 100644 --- a/src/main/java/reactor/ipc/netty/http/client/HttpClientOptions.java +++ b/src/main/java/reactor/ipc/netty/http/client/HttpClientOptions.java @@ -114,7 +114,7 @@ final String formatSchemeAndHost(String url, boolean ws) { if (url.startsWith("/")) { SocketAddress remote = getAddress(); - if (remote != null && !useProxy() && remote instanceof InetSocketAddress) { + if (remote != null && remote instanceof InetSocketAddress) { InetSocketAddress inet = (InetSocketAddress) remote; return scheme + inet.getHostName() + ":" + inet.getPort() + url; diff --git a/src/test/java/reactor/ipc/netty/http/client/HttpClientOptionsTest.java b/src/test/java/reactor/ipc/netty/http/client/HttpClientOptionsTest.java index 3b4917f90c..c134b39320 100644 --- a/src/test/java/reactor/ipc/netty/http/client/HttpClientOptionsTest.java +++ b/src/test/java/reactor/ipc/netty/http/client/HttpClientOptionsTest.java @@ -157,6 +157,17 @@ public void formatSchemeAndHostRelativeAddressSsl() throws Exception { assertThat(test2).isEqualTo("wss://example:8080/foo"); } + @Test + public void formatSchemeAndHostRelativeAndProxy() { + String test = this.builder.proxyOptions(proxyOptions) + .host("google.com") + .port(80) + .build() + .formatSchemeAndHost("/foo", false); + + assertThat(test).isEqualTo("http://google.com:80/foo"); + } + @Test public void formatSchemeAndHostAbsoluteHttp() throws Exception { String test1 = this.builder.build()