Unify HTTP client redirect behavior and provide configuration option

Update `ClientHttpRequestFactoryBuilder` implementations to ensure
that all libraries have consistent redirect follow behavior. Following
of redirects is enabled by default.

The `ClientHttpRequestFactorySettings` may be used to change if
redirects should be followed. The `spring.http.client.redirects`
property may also be used to update the default behavior.

Closes gh-42879
This commit is contained in:
Phillip Webb
2024-10-25 00:46:01 -07:00
parent a92001130f
commit 36a22fcd59
20 changed files with 307 additions and 74 deletions

View File

@@ -1018,7 +1018,7 @@ public class TestRestTemplate {
@SuppressWarnings("removal")
public CustomHttpComponentsClientHttpRequestFactory(HttpClientOption[] httpClientOptions,
org.springframework.boot.web.client.ClientHttpRequestFactorySettings settings) {
this(httpClientOptions, new ClientHttpRequestFactorySettings(settings.connectTimeout(),
this(httpClientOptions, new ClientHttpRequestFactorySettings(null, settings.connectTimeout(),
settings.readTimeout(), settings.sslBundle()));
}