mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 05:49:04 +00:00
Do not send null HTTP header value in JdkClientHttpRequest
Prior to this commit, the `JdkClientHttpRequest` would add all values from `HttpHeaders` to the native request builder. This could cause `NullPointerException` being thrown at runtime because the `HttpClient` does not support that. This commit replicates a fix that was applied to the `SimpleClientHttpRequest`, turning null values into empty "". Fixes gh-35996
This commit is contained in:
@@ -175,7 +175,7 @@ class JdkClientHttpRequest extends AbstractStreamingClientHttpRequest {
|
||||
headers.forEach((headerName, headerValues) -> {
|
||||
if (!DISALLOWED_HEADERS.contains(headerName.toLowerCase(Locale.ROOT))) {
|
||||
for (String headerValue : headerValues) {
|
||||
builder.header(headerName, headerValue);
|
||||
builder.header(headerName, (headerValue != null) ? headerValue : "");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user