Does Spring @RequestBody support the GET method?

2020-02-10 14:03发布

I am trying to carry JSON data in an HTTP GET request message, but my Spring MVC server can't seem to retrieve the JSON data from the GET request body.

1条回答
做自己的国王
2楼-- · 2020-02-10 15:04

HTTP's GET method does not include a request body as part of the spec. Spring MVC respects the HTTP specs. Specifically, servers are allowed to discard the body. The request URI should contain everything needed to formulate the response.

If you need a request body, change the request type to POST, which does include the request body.

查看更多
登录 后发表回答