Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to access request body using getBodyAsJson() in Vert.X 3.0.0

Tags:

http

vert.x

I am using Vert.x 3.0.0-milestone5, to develop a sample web application. Everything is working fine as far as the routing is concerned, but I am not able to access request parameters using routingContext.getBodyAsJson() or routingContext.getBody() or routingContext.getBodyAsString(). Here is the complete description.

like image 564
Rahul Bhooteshwar Avatar asked Jun 16 '15 04:06

Rahul Bhooteshwar


1 Answers

If you want to use

routingContext.getBody();
routingContext.getBodyAsJson();

You first need to add a body handler like below:

router.route().handler(BodyHandler.create());
like image 74
aruis Avatar answered Oct 26 '22 13:10

aruis