what is `body` here?
# arrow
p
what is
body
here?
g
The
body
method is from the class
org.springframework.web.reactive.function.server.DefaultServerResponseBuilder
and this is the method signature:
Copy code
public <T, P extends Publisher<T>> Mono<ServerResponse> body(P publisher, Class<T> elementClass)
This is how I am using it, to return a Mono<ServerResponse> from my controller
This is from routes `
Copy code
GET("/{$PATH_ID}", itemsRouteHandler::getOrder)
This is the method
Copy code
fun getOrder(request: ServerRequest): Mono<ServerResponse> {
            val monoK: MonoK<Item> = MonoK.monad().fx.monad {
                val uuid = pathParamToUUID(request, PATH_ID).bind()
                itemService.getItem(uuid).bind()
            }.fix()
            val monoResponse: Mono<ServerResponse> = ok().body(monoK.mono, Item::class.java)
            return monoResponse
        }