Closed
Description
Currently, return type ResponseEntity<Mono<ModelClass>>
or ResponseEntity<Flux>` is supported.
Example:
@Override
public Mono<ResponseEntity<Quote>> getQuote(String id, ServerWebExchange exchange) {
return quotes.getQuote(id)
.map(ResponseEntity::ok)
.switchIfEmpty(Mono.just(ResponseEntity.notFound().build()));
}
Whereas without the response entity wrapped it looks like this there is no way to set the response status deliberately.
@Override
public ResponseEntity<Mono<Quote>> getQuote(String id, ServerWebExchange exchange) {
return ResponseEntity.ok(quotes.getQuote(id));
}
I had a look at the source code, but to me there is no obvious way of doing this. Should it be possible to specify a generic type as result mapping, should it be a flag. If you point me in the right direction, I can make an effort of providing a PR.
Metadata
Metadata
Assignees
Labels
No labels