Description
Affects: 5.2.0
Hello,
When a DecodingException
is thrown from a reactive handler chain, it is mapped to a ServerWebInputException
, with a generic Failed to read HTTP message
reason:
https://github.com/spring-projects/spring-framework/blob/d1aee0e8691c41753621332ff69b17be3f7c8ba2/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequest.java#L73
As a consequence, all bad request bodies are similar, regardless of what caused them in the first place:
{"timestamp":"2019-10-10T13:32:32.210+0000","path":"/some-path","status":400,"error":"Bad Request","message":"Failed to read HTTP message"}
The client is not provided with any helpful message indicating why the request was unsuccessful, it's not even clear that this was caused by a failure to decode the body in the first place.
For example, when using a AbstractJackson2Decoder
, the DecodingException
contains much more useful information, such as:
JSON decoding error: Missing required creator property 'xxxxxx'
Could such information be included as part of the Bad Request response?
Thanks for reading!
Pyves