Hey! So I just came across this for the first time...
# ktor
a
Hey! So I just came across this for the first time after using Ktor for a while, and I'm sure someone will have run into this before and knows the most idiomatic way of solving it. I've got a route that I want to handle for both put and post, and I was wondering if there's a way of handling both methods without using the more general
handle {}
, because I really like the DSL for
get{}
,
put{}
,
post{}
...etc
o
Not at the moment, but I think it can be done by making
route
function accept varargs of method: Current:
Copy code
fun Route.route(path: String, method: HttpMethod, build: Route.() -> Unit): Route
Change:
Copy code
fun Route.route(path: String, vararg method: HttpMethod, build: Route.() -> Unit): Route
and changing
HttpMethodRouteSelector
accordingly
Not sure about performance implications though.
a
I see... I'm looking closer at the documentation and maybe method(){} is an option as well. if the method argument becomes a vararg