[ 
https://issues.apache.org/jira/browse/CAMEL-21339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-21339:
--------------------------------
    Summary: camel-rest - Client request validation and empty body  (was: 
Client request validation and empty body)

> camel-rest - Client request validation and empty body
> -----------------------------------------------------
>
>                 Key: CAMEL-21339
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21339
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 4.8.0
>            Reporter: Olivier Jacquemart
>            Priority: Minor
>             Fix For: 4.8.1, 4.9.0
>
>
> If you enable the client request validation at a global level, and have a GET 
> rest endpoint, there is no need for a body validation.
> The problem is if the client sends the Content-type aplication/json. The 
> Content-Type is not needed tbut I got the issue because a client sends this 
> header all the time and I can't change it.
> I faced the issue while upgrading an application from 3.20.6 to 4.8.0. I
> Here are curl examples:
> {code:java}
> # succeeds
> $ curl localhost:8080/api/hello
> {"message":"hello world"}
> # fails
> $ curl -H "Content-Type: application/json" localhost:8080/api/hello
> Invalid JSon payload.{code}
>  
> In the problematic case, the 
> [DefaultRestClientRequestValidator|https://github.com/apache/camel/blob/main/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultRestClientRequestValidator.java]
>  will try to deserialize the json against an empty string and will fail 
> because it's not a valid json.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to