Closed mgeorge closed 4 weeks ago
try to use install(WidgetRouter::new)
instead of mount
Thanks - that did the trick.
Does that mean that mount
is now deprecated? The documentation still shows it as the first option for composing routers:
Also, sometimes you just need to call the constructor on the router in order to pass parameters. The mount
method is the obvious way to do this.
mount should work. There is a silly difference between them: mount
fetch install only routes from app, while install
copy services, routes, etc...
if so, that https://github.com/jooby-project/jooby/issues/3400 was the bug as well. And a fix (or at least a part of it) is here https://github.com/jooby-project/jooby/pull/3401/commits/7370e5a7add3229558faaac18dbe09e4fd886b63, can revive the PR
@kliushnichenko first of all apologies for missing the point when you raised the bug, but yea this is the same bug as #3400. Going to send PR and you can look if I'm still missing something
no worries, appreciate your support
Can confirm that this fixes my problem. Thanks for the good work.
This is a weird one that started happening since 3.0.8 onwards.
If I add a POST route that is declared in another router via a
mount
then I get a 415 error when POSTing a valid JSON payload.If I add the same route directly to the server, I get the expected valid response.
Best demonstrated via the following MWE:
Widget
is just a POJO with a couple of string fields.A POST containing valid JSON to
/api/widgets1
works and returns the expected 201 response.The same POST to
/api/widgets2
throws a 415 unsupported media type with the following stack trace:I'm using the following dependencies in my
build.gradle
:I've been messing around with this for a bit trying to work out why my service started breaking after I upgraded from 3.0.7 to 3.2.7, and as far as I can tell, it is the use of
mount
to add the route that leads to the 415 error.I've tried Jackson instead of Gson, and get the same result.
As mentioned, versions prior to 3.0.8 don't seem to have this problem.