Skip to content

Commit b19059f

Browse files
committed
Handle null from JDK HttpResponse#body
Closes gh-35692
1 parent b1f5b61 commit b19059f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-web/src/main/java/org/springframework/http/client/reactive/JdkClientHttpResponse.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ private static ResponseCookie toResponseCookie(HttpCookie cookie, @Nullable Stri
9898
}
9999

100100
private static Flux<DataBuffer> adaptBody(HttpResponse<Flow.Publisher<List<ByteBuffer>>> response, DataBufferFactory bufferFactory) {
101-
return JdkFlowAdapter.flowPublisherToFlux(response.body())
101+
102+
Flow.Publisher<List<ByteBuffer>> body = response.body();
103+
if (body == null) {
104+
return Flux.empty();
105+
}
106+
107+
return JdkFlowAdapter.flowPublisherToFlux(body)
102108
.flatMapIterable(Function.identity())
103109
.map(bufferFactory::wrap)
104110
.doOnDiscard(DataBuffer.class, DataBufferUtils::release)

0 commit comments

Comments
 (0)