-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)theme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin supporttype: regressionA bug that is also a regressionA bug that is also a regression
Milestone
Description
Affects: 5.3.13
When returning a ResponseEntity<Flux<[some class]>> when the function is suspended it unnests to Flux<[some class]> (tested: 5.3.13) while it previously unnested to [some class] (tested: 5.3.11).
Example
@RestController
class Controller(val service: SomeService) {
@GetMapping("/")
suspend fun getStrings(): ResponseEntity<Flux<ByteBuffer>> {
val strs: Flux<String> = service.getStrings()
// some coroutine function is called
val headers = HttpHeaders()
// Set headers
return ResponseEntity.ok().headers(headers).body(strs)
}
}
/**
* <= 5.3.11
* This worked fine
*
* 5.3.13
* Throws:
* org.springframework.http.converter.HttpMessageNotWritableException: No Encoder for [reactor.core.publisher.Flux<java.nio.ByteBuffer>] with preset Content-Type 'application/octet-stream'
**/This is due to the change in org.springframework.web.reactive.result.method.annotation.ResponseEntityResultHandler, where the function handleResult was changed to handle coroutinescommit. It runs nested once instead of twice, as it did before.
Mixing reactor and coroutines is bad practice, I'd guess. Therefore, I'm not certain what the desired behaviour is. Any thoughts?
rrittwag, tokuhirom and titeipa
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)theme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin supporttype: regressionA bug that is also a regressionA bug that is also a regression