Skip to content

Commit 51c9925

Browse files
committed
Merge pull request #43429 from nosan
* pr/43429: Don't replace existing defaultRequestConfigCustomizer Closes gh-43429
2 parents e394cad + 26ab0fe commit 51c9925

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilder.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ public HttpComponentsClientHttpRequestFactoryBuilder withDefaultRequestConfigCus
182182
Consumer<RequestConfig.Builder> defaultRequestConfigCustomizer) {
183183
Assert.notNull(defaultRequestConfigCustomizer, "'defaultRequestConfigCustomizer' must not be null");
184184
return new HttpComponentsClientHttpRequestFactoryBuilder(getCustomizers(), this.httpClientCustomizer,
185-
this.connectionManagerCustomizer, this.socketConfigCustomizer, defaultRequestConfigCustomizer,
185+
this.connectionManagerCustomizer, this.socketConfigCustomizer,
186+
this.defaultRequestConfigCustomizer.andThen(defaultRequestConfigCustomizer),
186187
this.tlsSocketStrategyFactory);
187188
}
188189

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilderTests.java

+6
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,25 @@ void withCustomizers() {
5555
TestCustomizer<HttpClientBuilder> httpClientCustomizer2 = new TestCustomizer<>();
5656
TestCustomizer<PoolingHttpClientConnectionManagerBuilder> connectionManagerCustomizer = new TestCustomizer<>();
5757
TestCustomizer<SocketConfig.Builder> socketConfigCustomizer = new TestCustomizer<>();
58+
TestCustomizer<SocketConfig.Builder> socketConfigCustomizer1 = new TestCustomizer<>();
5859
TestCustomizer<RequestConfig.Builder> defaultRequestConfigCustomizer = new TestCustomizer<>();
60+
TestCustomizer<RequestConfig.Builder> defaultRequestConfigCustomizer1 = new TestCustomizer<>();
5961
ClientHttpRequestFactoryBuilder.httpComponents()
6062
.withHttpClientCustomizer(httpClientCustomizer1)
6163
.withHttpClientCustomizer(httpClientCustomizer2)
6264
.withConnectionManagerCustomizer(connectionManagerCustomizer)
6365
.withSocketConfigCustomizer(socketConfigCustomizer)
66+
.withSocketConfigCustomizer(socketConfigCustomizer1)
6467
.withDefaultRequestConfigCustomizer(defaultRequestConfigCustomizer)
68+
.withDefaultRequestConfigCustomizer(defaultRequestConfigCustomizer1)
6569
.build();
6670
httpClientCustomizer1.assertCalled();
6771
httpClientCustomizer2.assertCalled();
6872
connectionManagerCustomizer.assertCalled();
6973
socketConfigCustomizer.assertCalled();
74+
socketConfigCustomizer1.assertCalled();
7075
defaultRequestConfigCustomizer.assertCalled();
76+
defaultRequestConfigCustomizer1.assertCalled();
7177
}
7278

7379
@Test

0 commit comments

Comments
 (0)