varpa89
06/07/2017, 9:23 AMfun foo(): Flux<ByteArray> {
val client = WebClient.create("<https://byte-array-service>")
return client
.get()
.uri("/info")
.accept(MediaType.APPLICATION_OCTET_STREAM)
.exchange()
.flatMapMany {
r -> r.bodyToFlux(ByteArray::class.java)
}
}
In my handler I do this
fun handleFoo(req: ServerRequest) = myService
.foo()
.flatMap {
ok().body(BodyInserters.fromObject(it))
}
Compile is ok byt maybe I was wrong with BodyInserter. But my router does not compile
"/foo".nest {
GET("/", myHandler::handleFoo)
}