Request to the endpoint fails with the following error:
400 Bad request
org.springframework.http.converter.HttpMessageNotReadableException:
Required request body is missing
@GetMapping
public List<SomeObject> list(@RequestParam(required = false) String parameter, @RequestBody String body, @RequestHeader("Authorization") String token) {
.....
}
if @GetMapping
would be changed to @PostMapping
everything works like a charm though.
Any ideas what the heck is going on ?
NOTE: Swagger is used for request sending, so it is quite unlikely that the error is in Curl
UPDATE:
So, it looks like Spring does not support @RequestBody
for @GetMapping
. I still can not figure out why ? @DeleteMapping
with @RequestBody
works fine and according to HTTP/1.1 GET requests could potentially contain the body - stackoverflow.com/questions/978061/http-get-with-request-body
IMO it looks a bit inconsistent to allow body in DELETE
but forbid in GET
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…