Hi folks,
I'm stuck with an HttpRequest query processing. I try to return a stream who contains a subpart of a a REST stream response. eg:
GET /foo
=>
{
bar: {},
....
results: [
{foo: 1},
{foo: 2},
{foo: 3},
{foo: 4},
{foo: 5},
....
{foo: 1000000}
]
}
What I want to stream :
[
{foo: 1},
{foo: 2},
{foo: 3},
{foo: 4},
{foo: 5},
....
{foo: 1000000}
]
My current code use akka-stream-circe and akka-http-circe and looks like :
val request = HttpRequest(uri =
Uri(cfg.get[String]("my.endpoint"))
.withPath(Path("/foo"))
.withQuery(Query("search" -> "foo"))
)
Http()
.singleRequest(request)
.map(response => response.entity.dataBytes.via( CirceStreamSupport.decode[???????????????????????] )) pipeTo sender
Unfortunately, I don't understand how to configure Jawn with Circe to "ignore" all json content except this array... Maybe Akka HTTP module allow me to do that out of the box ?
Regards,