Merge branch '5.1.x'

This commit is contained in:
Rossen Stoyanchev
2019-05-15 16:44:05 -04:00
4 changed files with 17 additions and 10 deletions

View File

@@ -874,7 +874,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Set the {@link Locale} of the content language,
* as specified by the {@literal Content-Language} header.
* <p>Use {@code set(CONTENT_LANGUAGE, ...)} if you need
* <p>Use {@code set(CONTENT_LANGUAGE, list)} if you need
* to set multiple content languages.</p>
* @since 5.0
*/

View File

@@ -119,7 +119,8 @@ public class EncoderHttpMessageWriter<T> implements HttpMessageWriter<T> {
if (inputStream instanceof Mono) {
HttpHeaders headers = message.getHeaders();
return Mono.from(body)
return body
.singleOrEmpty()
.switchIfEmpty(Mono.defer(() -> {
headers.setContentLength(0);
return message.setComplete().then(Mono.empty());