Skip to content

Commit d58a884

Browse files
nictastwoseat
authored andcommitted
Better customization options for the underlying HTTP client
1 parent c148115 commit d58a884

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/_DefaultConnectionContext.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import java.time.Duration;
5050
import java.util.List;
5151
import java.util.Optional;
52+
import java.util.function.UnaryOperator;
5253

5354
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
5455
import static io.netty.channel.ChannelOption.CONNECT_TIMEOUT_MILLIS;
@@ -102,9 +103,11 @@ public Integer getConnectionPoolSize() {
102103
@Override
103104
@Value.Default
104105
public HttpClient getHttpClient() {
105-
return createHttpClient().compress(true)
106+
HttpClient client = createHttpClient().compress(true)
106107
.tcpConfiguration(this::configureTcpClient)
107108
.secure(this::configureSsl);
109+
return getAdditionalHttpClientConfiguration().map(configuration -> configuration.apply(client))
110+
.orElse(client);
108111
}
109112

110113
@Override
@@ -221,6 +224,11 @@ Optional<SslCertificateTruster> getSslCertificateTruster() {
221224
* The timeout for the SSL handshake negotiation
222225
*/
223226
abstract Optional<Duration> getSslHandshakeTimeout();
227+
228+
/**
229+
* Additional configuration to the underlying HttpClient
230+
*/
231+
abstract Optional<UnaryOperator<HttpClient>> getAdditionalHttpClientConfiguration();
224232

225233
@Value.Derived
226234
LoopResources getThreadPool() {

0 commit comments

Comments
 (0)