Skip to content

Commit

Permalink
Don't replace existing defaultRequestConfigCustomizer
Browse files Browse the repository at this point in the history
Update `HttpComponentsClientHttpRequestFactoryBuilder` to add to the
existing `defaultRequestConfigCustomizer` rather than replace it.

See gh-43429
  • Loading branch information
nosan authored and philwebb committed Dec 7, 2024
1 parent e394cad commit 26ab0fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ public HttpComponentsClientHttpRequestFactoryBuilder withDefaultRequestConfigCus
Consumer<RequestConfig.Builder> defaultRequestConfigCustomizer) {
Assert.notNull(defaultRequestConfigCustomizer, "'defaultRequestConfigCustomizer' must not be null");
return new HttpComponentsClientHttpRequestFactoryBuilder(getCustomizers(), this.httpClientCustomizer,
this.connectionManagerCustomizer, this.socketConfigCustomizer, defaultRequestConfigCustomizer,
this.connectionManagerCustomizer, this.socketConfigCustomizer,
this.defaultRequestConfigCustomizer.andThen(defaultRequestConfigCustomizer),
this.tlsSocketStrategyFactory);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,25 @@ void withCustomizers() {
TestCustomizer<HttpClientBuilder> httpClientCustomizer2 = new TestCustomizer<>();
TestCustomizer<PoolingHttpClientConnectionManagerBuilder> connectionManagerCustomizer = new TestCustomizer<>();
TestCustomizer<SocketConfig.Builder> socketConfigCustomizer = new TestCustomizer<>();
TestCustomizer<SocketConfig.Builder> socketConfigCustomizer1 = new TestCustomizer<>();
TestCustomizer<RequestConfig.Builder> defaultRequestConfigCustomizer = new TestCustomizer<>();
TestCustomizer<RequestConfig.Builder> defaultRequestConfigCustomizer1 = new TestCustomizer<>();
ClientHttpRequestFactoryBuilder.httpComponents()
.withHttpClientCustomizer(httpClientCustomizer1)
.withHttpClientCustomizer(httpClientCustomizer2)
.withConnectionManagerCustomizer(connectionManagerCustomizer)
.withSocketConfigCustomizer(socketConfigCustomizer)
.withSocketConfigCustomizer(socketConfigCustomizer1)
.withDefaultRequestConfigCustomizer(defaultRequestConfigCustomizer)
.withDefaultRequestConfigCustomizer(defaultRequestConfigCustomizer1)
.build();
httpClientCustomizer1.assertCalled();
httpClientCustomizer2.assertCalled();
connectionManagerCustomizer.assertCalled();
socketConfigCustomizer.assertCalled();
socketConfigCustomizer1.assertCalled();
defaultRequestConfigCustomizer.assertCalled();
defaultRequestConfigCustomizer1.assertCalled();
}

@Test
Expand Down

0 comments on commit 26ab0fe

Please sign in to comment.