Sobes.tech
Middle

According to the HTTP standard and RESTful style, can a GET request have a body?

sobes.tech AI

Answer from AI

According to the HTTP/1.1 standard, a body in a GET request is technically possible but not recommended and not a common practice in RESTful APIs. RFC 7231 does not prohibit a body in GET, but it states that servers usually ignore the body in GET requests.

In RESTful style, GET requests should be idempotent and used to retrieve resources without side effects. Including a request body in GET can lead to ambiguities and issues with caching, proxies, and other intermediaries.

Therefore, if parameters need to be transmitted, it is better to use URL parameters (query string) rather than the request body.