hfhbd
04/11/2022, 4:01 AM@KtorDsl val myPlugin = createRouteScopedPlugin("myPlugin, ::Config) {}
AND to @KtorDsl class Config
too?hfhbd
04/11/2022, 4:02 AMthis@routing.install
and this@routing.get
...Aleksei Tirman [JB]
04/11/2022, 11:54 AMRustam Siniukov
04/11/2022, 12:43 PMhfhbd
04/11/2022, 4:37 PMhfhbd
04/11/2022, 4:38 PM@KtorDsl
val RateLimit = createRouteScopedPlugin("RateLimit, ::Config) {}
@KtorDsl
class Config
routing {
get {
call.respondText { "42" }
}
route("/login") {
this@routing.install(RateLimit) {
this@route.get {
call.respondText { "/login called" }
}
}
}
}
Rustam Siniukov
04/11/2022, 5:19 PMKtorDsl
has @Target(AnnotationTarget.CLASS, AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE, AnnotationTarget.FUNCTION)
you can’t apply it to val RateLimit = createRouteScopedPlugin("RateLimit, ::Config) {}
hfhbd
04/11/2022, 6:57 PM@KtorDsl fun RateLimit(requiredParameter) = createRouteScopedPlugin(...)
. But in the end, install
works without explicit this
. But get
does not.
At least the docs are wrong.