mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Use singleOrEmpty to avoid upstream cancel
Closes gh-22952
This commit is contained in:
+2
-1
@@ -120,7 +120,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());
|
||||
|
||||
Reference in New Issue
Block a user