The following documentation http://vertx.io/docs/vertx-web/groovy/#_request_body_handling is not completelly clear. Turns out that BodyHandler must be defined before any route definitions, but the documentation only advices to define it as soon as possible.
You should make sure a body handler is on a matching route for any requests that require this functionality.
The usage of this handler requires that it is installed as soon as possible in the router since it needs to install handlers to consume the HTTP request body and this must be done before executing any async call.
Or is this a bug?
The following is a gist with reproducible code.
def router = Router.router(vertx)def route = router.route(HttpMethod.POST,"/method")router.route().handler(BodyHandler.create())nullThat will not work because of the order you're setting:
even though you write the handler code in the end you registered the route before the body handler so it will be invoked first.
Yes I know the order is what makes or break, that's what I demonstrated and what I mean by "the documentation is not clear".
Anyways, at least it is clarified somewhere so I'm closing.
Most helpful comment
Yes I know the order is what makes or break, that's what I demonstrated and what I mean by "the documentation is not clear".
Anyways, at least it is clarified somewhere so I'm closing.