Handle null from JDK HttpResponse#body

Closes gh-35692
This commit is contained in:
rstoyanchev
2025-10-27 21:48:33 +00:00
parent b1f5b61bcd
commit b19059f6cb
@@ -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)