Remove buffering of encoded parts in MultipartHttpMessageWriter

Closes gh-23518
This commit is contained in:
Arjen Poutsma
2019-08-29 16:11:23 +02:00
parent 2c5958e191
commit d709a69ff1
2 changed files with 6 additions and 6 deletions

View File

@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
@@ -249,8 +248,8 @@ public class MultipartHttpMessageWriter extends LoggingCodecSupport
private Flux<DataBuffer> encodePartValues(
byte[] boundary, String name, List<?> values, DataBufferFactory bufferFactory) {
return Flux.concat(values.stream().map(v ->
encodePart(boundary, name, v, bufferFactory)).collect(Collectors.toList()));
return Flux.fromIterable(values)
.concatMap(value -> encodePart(boundary, name, value, bufferFactory));
}
@SuppressWarnings("unchecked")