what is a clean way to have the same code for get(...
# ktor
b
what is a clean way to have the same code for get("/") and post("/") ?
d
Define the lambda beforehand and then pass it to both?
p
Just wondering what's the use case to have both get and post for the same url if you will handle them in the same way.
b
because a service I do not have control over uses get for small requests and post for large
Trying to make a lambda would force me to make a suspend lambda and I can't find a way to write it
Copy code
val foo = fun PipelineContext<Unit, ApplicationCall>.(it: Unit) {
            val query = call.receiveParameters()["query"]
            val content = "test"
            call.respondText(
                content
                , ContentType.Text.Plain
            )
        }
Copy code
suspend fun request(ctx: PipelineContext<Unit, ApplicationCall>) {
            val query = ctx.call.receiveParameters()["query"] …} 
post("/") { request(this) }
works like that