Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Unknown
Description
Small thing I noticed when configuring a REST route with clientRequestValidation = true with camel-platform-http-vertx. E.g like:
.post("/validation") .clientRequestValidation(true) .param().name("foo").type(RestParamType.body).required(true).endParam() .route() .setBody(simple("Hello ${header.foo}")) .endRest()
If I don't provide a body in the POST request, then I'd expect a 400 status code. But it actually returns 200 as the Vert.x body handler initialises an empty Buffer which when converted to String results in an empty String.
Thus this condition is false and Camel thinks the request is valid:
Maybe instead of checking for null it should do ObjectHelper.isEmpty? Not sure if that is a 'safe' thing to do or if there's some scenario where an empty string body has some kind of meaning?
Attachments
Issue Links
- links to