HttpEntity.EMPTY should be immutable

See gh-34812

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
This commit is contained in:
Yanming Zhou
2025-04-24 17:36:29 +08:00
committed by rstoyanchev
parent 5013d6d771
commit d7c13d6518
2 changed files with 10 additions and 1 deletions

View File

@@ -49,6 +49,7 @@ import org.springframework.util.ObjectUtils;
*
* @author Arjen Poutsma
* @author Juergen Hoeller
* @author Yanming Zhou
* @since 3.0.2
* @param <T> the body type
* @see org.springframework.web.client.RestTemplate
@@ -60,7 +61,7 @@ public class HttpEntity<T> {
/**
* The empty {@code HttpEntity}, with no body or headers.
*/
public static final HttpEntity<?> EMPTY = new HttpEntity<>();
public static final HttpEntity<?> EMPTY = new HttpEntity<>(HttpHeaders.EMPTY);
private final HttpHeaders headers;