-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
It would be nice to be able to send a body with a GET request. I understand that this may not be considered a good practice, but this is necessary for the API that I have to work with.
RFC 2616, section 4.3 clearly states:
A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests.
https://tools.ietf.org/html/rfc2616#section-4.3
However, in the entirety of section 9.3, the section defining the GET verb, nothing prevents a GET request from having a body.
But before you draw any conclusions - the functionality defined for the GET verb also does not include any logic involving the message body.
In other words, if we are to follow the specification:
- It is possible to send a message body with a GET request per specification.
- However, the server responding to the GET request must ignore the body to follow the standard.
Essentially, there is no point, per standard, to send a body with a GET request, even though it is not explicitly disallowed.
Roy T. Fielding backs this interpretation up:
...any HTTP request message is allowed to contain a message body, and thus must parse messages with that in mind. Server semantics for GET, however, are restricted such that a body, if any, has no semantic meaning to the request. The requirements on parsing are separate from the requirements on method semantics.
So, yes, you can send a body with GET, and no, it is never useful to do so.
https://groups.yahoo.com/neo/groups/rest-discuss/conversations/messages/9962
More about this: swagger-api/swagger-ui#2136