From @sdeleuze on slack:

Looks like there is a bug in AbstractMessageWriterResultHandler#writeBody for those use cases with a confusion between leveraging bodyParameter versus actualParam. Could you please create an issue in https://github.com/spring-projects/spring-framework/issues pinging me (@sdeleuze) and linking your repro?

Reproduction repository at https://github.com/Kantis/kxs-repro

The bug

When using KotlinX serialization with Webflux, we expect that any combination of presence/absence of suspend functions and ResponseEntity to play nicely together.

As the repro demonstrates, that is not the case. KotlinX serialization is only used in one of the 4 possible setups:

Suspend with ResponseEntity ❌ Suspend without ResponseEntity ✅ No suspend with ResponseEntity ❌ No suspend without ResponseEntity ❌