mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-09 00:29:04 +00:00
Prior to this commit, JdkClientHttpRequestFactoryTests verified the `jdk.httpclient.allowRestrictedHeaders` support by setting the system property in a @BeforeAll method and sending a request with an "Expect" header. However, the JDK HttpClient reads that property only once, in a static initializer, and JdkClientHttpRequest caches it in a static field as well. Consequently, the test failed whenever another test class (such as ClientHttpConnectorTests) initialized the HttpClient first in the same JVM, making the build dependent on test class execution order. That test also exercised the JDK's own enforcement of restricted headers more than any logic in Spring, so it provided little value for the cost. Since we aim for reliable builds, in order to avoid problems with the Spring portfolio release trains, such order-dependent failures are not acceptable. This commit therefore removes the end-to-end test, makes JdkClientHttpRequest.disallowedHeaders() package-private, and tests it directly, setting and restoring the system property around each call.