https://kotlinlang.org logo
#http4k
Title
# http4k
r

Razvan

01/15/2021, 11:24 AM
Do you have an example with using a
Query.composite
lens for injecting an object in the request, In the doc you give the example:
Copy code
val pageable = Query.composite {
        Pageable(
            boolean().defaulted("sortAscending", true)(it),
            int().defaulted("page", 1)(it),
            int().defaulted("maxResults", 20)(it)
        )
    }
but it creates a Pageable object from the request. Is it possible to make it bidirectionnal and use the lens to inject these query parms from the object in order to use it like ?
Copy code
Response(OK).with(
           pageable of pageableObject
        )
It was under my nose when poking around ZipkinTraces problems, there's an example in
ZipkinTraces
Copy code
private val lens = Header.composite(get(), set())
4 Views