mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Handle null from JDK HttpResponse#body
Closes gh-35692
This commit is contained in:
+7
-1
@@ -98,7 +98,13 @@ class JdkClientHttpResponse extends AbstractClientHttpResponse {
|
||||
}
|
||||
|
||||
private static Flux<DataBuffer> adaptBody(HttpResponse<Flow.Publisher<List<ByteBuffer>>> response, DataBufferFactory bufferFactory) {
|
||||
return JdkFlowAdapter.flowPublisherToFlux(response.body())
|
||||
|
||||
Flow.Publisher<List<ByteBuffer>> body = response.body();
|
||||
if (body == null) {
|
||||
return Flux.empty();
|
||||
}
|
||||
|
||||
return JdkFlowAdapter.flowPublisherToFlux(body)
|
||||
.flatMapIterable(Function.identity())
|
||||
.map(bufferFactory::wrap)
|
||||
.doOnDiscard(DataBuffer.class, DataBufferUtils::release)
|
||||
|
||||
Reference in New Issue
Block a user