File tree 1 file changed +5
-1
lines changed
spring-web/src/main/java/org/springframework/http/client/reactive 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 33
33
import org .springframework .core .io .buffer .DataBuffer ;
34
34
import org .springframework .core .io .buffer .DataBufferFactory ;
35
35
import org .springframework .core .io .buffer .DataBufferUtils ;
36
+ import org .springframework .core .io .buffer .PooledDataBuffer ;
36
37
import org .springframework .http .HttpHeaders ;
37
38
import org .springframework .http .HttpMethod ;
38
39
import org .springframework .http .MediaType ;
@@ -94,7 +95,10 @@ public Mono<Void> writeWith(Publisher<? extends DataBuffer> body) {
94
95
95
96
@ Override
96
97
public Mono <Void > writeAndFlushWith (Publisher <? extends Publisher <? extends DataBuffer >> body ) {
97
- Flux <ContentChunk > chunks = Flux .from (body ).flatMap (Function .identity ()).map (this ::toContentChunk );
98
+ Flux <ContentChunk > chunks = Flux .from (body )
99
+ .flatMap (Function .identity ())
100
+ .doOnDiscard (PooledDataBuffer .class , DataBufferUtils ::release )
101
+ .map (this ::toContentChunk );
98
102
ReactiveRequest .Content content = ReactiveRequest .Content .fromPublisher (chunks , getContentType ());
99
103
this .reactiveRequest = ReactiveRequest .newBuilder (this .jettyRequest ).content (content ).build ();
100
104
return doCommit (this ::completes );
You can’t perform that action at this time.
0 commit comments