I was a little surprised, but I’m sure there’s a logical explanation for this. Parameter “name” is null inside the interceptor but not inside the route. Is there another way to do this kind of thing?
Copy code
fun main(args: Array<String>) {
val server = embeddedServer(Netty, port = 9000) {
intercept(ApplicationCallPipeline.Call) {
val name = call.parameters["name"]
proceed()
}
routing {
get("/login/{name}") {
val name = call.parameters["name"]
call.respond("Hello $name")
}
}
}
server.start(wait = true)
}
✅ 1
📝 1
katokay
06/30/2018, 12:04 AM
Was able to work around it by using the process described here. It feels like there should be a bit simpler way to do something like this though.
https://ktor.io/advanced/pipeline/route.html