Fix unwrapping logic for ResponseEntity<Flux>
This commit makes sure that the response returned by coroutine handler methods that return ResponseEntity<Flux> is unwrapped correctly. Closes gh-27809
This commit is contained in:
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.core.KotlinDetector;
|
||||
@@ -130,7 +131,8 @@ public abstract class AbstractMessageWriterResultHandler extends HandlerResultHa
|
||||
if (adapter != null) {
|
||||
publisher = adapter.toPublisher(body);
|
||||
boolean isUnwrapped = KotlinDetector.isSuspendingFunction(bodyParameter.getMethod()) &&
|
||||
!COROUTINES_FLOW_CLASS_NAME.equals(bodyType.toClass().getName());
|
||||
!COROUTINES_FLOW_CLASS_NAME.equals(bodyType.toClass().getName()) &&
|
||||
!Flux.class.equals(bodyType.toClass());
|
||||
ResolvableType genericType = isUnwrapped ? bodyType : bodyType.getGeneric();
|
||||
elementType = getElementType(adapter, genericType);
|
||||
actualElementType = elementType;
|
||||
|
||||
Reference in New Issue
Block a user