From 010e8a303b1caf3b80e244fc5e4aebc23d854118 Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Wed, 15 May 2024 20:06:48 +0100 Subject: [PATCH] Polishing contribution Closes gh-32799 --- .../http/client/reactive/JdkClientHttpRequest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/client/reactive/JdkClientHttpRequest.java b/spring-web/src/main/java/org/springframework/http/client/reactive/JdkClientHttpRequest.java index 5e62a427964..2295d4ba2cb 100644 --- a/spring-web/src/main/java/org/springframework/http/client/reactive/JdkClientHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/client/reactive/JdkClientHttpRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -110,10 +110,11 @@ class JdkClientHttpRequest extends AbstractClientHttpRequest { @Override protected void applyCookies() { MultiValueMap cookies = getCookies(); - if (!cookies.isEmpty()) { - this.builder.header(HttpHeaders.COOKIE, cookies.values().stream() - .flatMap(List::stream).map(HttpCookie::toString).collect(Collectors.joining(";"))); + if (cookies.isEmpty()) { + return; } + this.builder.header(HttpHeaders.COOKIE, cookies.values().stream() + .flatMap(List::stream).map(HttpCookie::toString).collect(Collectors.joining(";"))); } @Override