-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kotlin: mount of coroutine routes doesn't work #3228
Comments
Your 2nd second example should work. The way it works is like Parent/Child or MainRoute/SubRoute. So we can define all the routes/API/etc in children while main assemble everything and provide/setup all other services (like jackson here) |
Maybe the hierarchical structure need some specifications of some sort of "context" or "scoping"? I find each SubRoute implemented by inheriting |
yea, doc isn't never good enough. mount: https://jooby.io/#router-composing-mount
install: https://jooby.io/#router-composing-install
This sound like a bug. Can you file it and provide an example? Thanks |
It only happens when calling class RouterWithoutWorker : Kooby({
coroutine {
get("/without-worker") { "Without worker!" }
}
})
class RouterWithoutWorkerNoCoroutine : Kooby({
get("/without-worker-no-coroutine") { "Without worker, no coroutine!" }
})
class RouterWithWorker(worker: Executor) : Kooby({
this.worker = worker
coroutine {
get("/with-worker") { "With worker!" }
}
})
fun main(args: Array<String>) {
runApp(args) {
mount(RouterWithWorker(this.worker))
mount(RouterWithoutWorker())
coroutine {
mount(RouterWithoutWorkerNoCoroutine())
}
}
} Both
I am not sure if calling |
For example:
Getting
/api/beans
with headerAccept: application/json
will return406 Not Acceptable
withIf I replace
mount(RouterWithDecoder())
withinstall(::RouterWithDecoder)
, the server WILL acceptapplication/json
.However, if
install(JacksonModule(jacksonObjectMapper()))
is replaced by a customized decoder inRouterWithDecoder
, eg.then mount the router by
install(::RouterWithDecoder)
statement will fail to acceptapplication/json
again.After further tests, I find:
JacksonModule
globally before mounting routers bymount()
method will acceptapplication/json
.mount()
or byinstall()
, will NOT acceptapplication/json
The text was updated successfully, but these errors were encountered: