February 2018
Intermediate to advanced
406 pages
9h 55m
English
If the request has errors in the format of the request body being submitted (for example, invalid JSON), then Spring throws an error before it reaches the method.
For example, for a POST request to http://localhost:8082/product, if the submitted body is missing commas, such as {"id":1 "name":"Fuji Apples" "catId":1}, then the error returned is 400 as follows. This indicates it is a badly formed request:
{
"timestamp": 1483701698917,
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.http.converter.HttpMessageNotReadableException",
"message": "Could not read document: Unexpected character ('"' (code 34)): was expecting comma to separate Object entriesn at ...
Likewise, a letter instead of a number, ...
Read now
Unlock full access