Skip to content

Commit da3b59e

Browse files
committed
Merge branch '6.1.x'
2 parents edb6bb7 + 010e8a3 commit da3b59e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

spring-web/src/main/java/org/springframework/http/client/reactive/JdkClientHttpRequest.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@
3737
import org.springframework.http.HttpHeaders;
3838
import org.springframework.http.HttpMethod;
3939
import org.springframework.util.Assert;
40+
import org.springframework.util.MultiValueMap;
4041

4142
/**
4243
* {@link ClientHttpRequest} for the Java {@link HttpClient}.
@@ -108,7 +109,11 @@ protected void applyHeaders() {
108109

109110
@Override
110111
protected void applyCookies() {
111-
this.builder.header(HttpHeaders.COOKIE, getCookies().values().stream()
112+
MultiValueMap<String, HttpCookie> cookies = getCookies();
113+
if (cookies.isEmpty()) {
114+
return;
115+
}
116+
this.builder.header(HttpHeaders.COOKIE, cookies.values().stream()
112117
.flatMap(List::stream).map(HttpCookie::toString).collect(Collectors.joining(";")));
113118
}
114119

0 commit comments

Comments
 (0)