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

Empty post body in HTTP server #102

Closed
leolux opened this issue Apr 29, 2015 · 5 comments
Closed

Empty post body in HTTP server #102

leolux opened this issue Apr 29, 2015 · 5 comments

Comments

@leolux
Copy link
Contributor

leolux commented Apr 29, 2015

If a HTTP client posts some String to a vert.x HTTP server the body received by the server seems to be empty although the server registered an BodyHandler.

I have created an reproducer for that issue.

@leolux
Copy link
Contributor Author

leolux commented Apr 29, 2015

@leolux
Copy link
Contributor Author

leolux commented May 2, 2015

This is trivial, isn't it?
I wasn't able to find a solution though 🐤

@purplefox
Copy link
Contributor

Try:

router.route().handler(BodyHandler.create());
router.route().method(HttpMethod.POST).path("/some/resource").handler(....)

You're overwriting the body handler with the second handler. Routes can only have one handler.

A very similar issue was discussed on the google group not very long ago.

Also....

In your main, you're deploying the Server immediately followed by the client without waiting, so there is no guarantee the server is started before the client sends the request.

@purplefox
Copy link
Contributor

When you do this:

router.route().handler(BodyHandler.create()).method(HttpMethod.POST).path("/some/resource")
.handler(otherHandler);

You're creating a single route, then first setting the handler to be a body handler, setting the method and path then setting the handler to be otherHandler (overwriting the bodyHandler).

@leolux
Copy link
Contributor Author

leolux commented May 2, 2015

Yeah, that's it. I must have been blind :-)
Thank you!

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

No branches or pull requests

2 participants