https://kotlinlang.org logo
#ktor
Title
# ktor
a

Andreas Scheja

05/02/2022, 11:45 AM
I'm currently upgrading one of my projects to ktor V2, but using the new plugin API there is no (non-internal) way to
finish()
a call from inside a
onCall
handler. Is that intended?
e

e5l

05/02/2022, 11:46 AM
Hi! Could you tell me why do you need to use finish?
a

Andreas Scheja

05/02/2022, 11:50 AM
I have a rate-limiting plugin that is expected to terminate requests with a 429 when the rate limit is reached
e

e5l

05/02/2022, 11:56 AM
Now it’s fine to use
call.respond(…)
in
onCall
handler: the call will not be passed to routing in this case.
You also can use
call.isHandled
flag to check if some other plugin wrote response before
a

Andreas Scheja

05/02/2022, 11:59 AM
Will try, thanks!
2 Views