Hey all, is there any way to get the path provided...
# ktor
a
Hey all, is there any way to get the path provided to the
get() {...}
route from a plugin? If not, is there at least a way where I can get the parameters from a request inside a plugin?
a
You can access parameters via
ApplicationCall.parameters
object:
Copy code
val plugin = createRouteScopedPlugin("plugin") {
    onCall { call ->
        println("ID: ${call.parameters["id"]}")
    }
}

fun main() {
    embeddedServer(Netty, port = 4444) {
        routing {
            route("/{id}") {
                install(plugin)
                get {}
            }

        }
    }.start(wait = true)
}
a
Thanks! There is no way of getting the route, correct?
a
Unfortunately, no.
a
Okay. I figured out a way to get around that. It's not super pretty, but oh well. Hopefully that gets implemented in Ktor's future