Hi there folks! I have a questions what has change...
# ktor
a
Hi there folks! I have a questions what has changed in behaviour of
intercept
for
Pipelines
between 2.x a and 3.2 we used to have nested routes like
Copy code
route("x"){
   get("") {...}
   route("/b") {
     intercept(ApplicationCallPipeline.Call) { ...}
     get("")
   } 
}
in 3.2 nested intercept affects parent intercept and previously
intercept(ApplicationCallPipeline.Call)
was always called before we end up in the handler code and now it is not called before the handler is called Maybe we were relying on some undocumented behaviour ... do not really know. Any help is appreciated, Thx in advance!
a
It's not recommended to directly add the interceptors to the routes. Instead, you can install a route-scoped plugin into a route:
Copy code
val plugin = createRouteScopedPlugin("Plugin") {
    onCall {
        // ...
    }
}
routing {
    // ...
    route("/b") {
        install(plugin)
    }
}