Description
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:
# succeeds $ curl localhost:8080/api/hello {"message":"hello world"} # fails $ curl -H "Content-Type: application/json" localhost:8080/api/hello Invalid JSon payload.
In the problematic case, the DefaultRestClientRequestValidator will try to deserialize the json against an empty string and will fail because it's not a valid json.