totally separate question - can you define a Lens ...
# http4k
a
totally separate question - can you define a Lens with add'l function or post-processing? example:
val myLens = Query.nonEmptyString().required("ids")...split(";")
Within the route I can insert the request then add functions:
myLens(myRequest).split(";")
but is it possible to add the
split
to the Lens definition?
s
Yes, you can use
.map
for that:
Copy code
val lens =  Query.nonEmptyString().map { it.split(";") }.required("ids")
    println(lens(Request(GET, "").query("ids", "a;b;c")))
✔️ 1
👍 1