Skip to content
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

decoders not shared to the mounted routes #3400

Closed
kliushnichenko opened this issue Apr 2, 2024 · 2 comments · Fixed by #3401 or #3502
Closed

decoders not shared to the mounted routes #3400

kliushnichenko opened this issue Apr 2, 2024 · 2 comments · Fixed by #3401 or #3502
Labels
Milestone

Comments

@kliushnichenko
Copy link
Contributor

Unlike jooby2 in 3.x decoders installed in the main app is not applied to the routes were mounted from another app

class AppA extends Jooby {
    {
        post("/pets", ctx -> ctx.body(Pet.class));
    }
}

class MainApp extends Jooby {
    {
       install(new JacksonModule());
       mount(new AppA());
    }
  }

Now hit post("/pets") and you will catch UnsupportedMediaType error, cause Jackson decoder was overridden at the copy route stage.
Hope it wasn't changed intentionally and we can return the Jooby2 behaviour

kliushnichenko added a commit to kliushnichenko/jooby that referenced this issue Apr 2, 2024
@jknack
Copy link
Member

jknack commented Apr 2, 2024

there is a slightly difference between mount(Router) and install(Router). In your case install should work. Mount only import routes into the main app.

@jknack jknack added the question label Apr 2, 2024
@kliushnichenko
Copy link
Contributor Author

yeah, indeed install works as expected, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants