Skip to content

Commit

Permalink
Merge pull request #43429 from nosan
Browse files Browse the repository at this point in the history
* pr/43429:
  Don't replace existing defaultRequestConfigCustomizer

Closes gh-43429
  • Loading branch information
philwebb committed Dec 7, 2024
2 parents e394cad + 26ab0fe commit 51c9925
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 51c9925

Please sign in to comment.