@kopper what about using a delegate property? so smth like val dataParam = query...
solo @solonovamax@tech.lgbt
@kopper what about using a delegate property? so smth like
val dataParam = query<String>("data")
handle { request, response ->
val data by request.param(dataParam)
// use data
}
then you could also lazily parse it
if you're open to using a receiver in the lambda or context parameters for the request/response, you could even maybe have smth like
val dataParam = query<String>("data")
handle {
val data by dataParam
// use data
}
where handle has the following signature for context parameters:
fun handle(block: context(Request, Response) () -> Unit)
and then you have
context(request: Request)
operator fun <T, P> QueryParam.provideDelegate(thisRef: T, prop: KProperty<*>): ReadOnlyProperty<T, P>