asyrjasalo / RESTinstance

Robot Framework library for RESTful JSON APIs
https://pypi.org/project/RESTinstance
GNU Lesser General Public License v3.0
206 stars 84 forks source link

Can not use Delete with a body #4

Closed nam-edi closed 6 years ago

nam-edi commented 6 years ago

I looked at the code and it seems impossible to use Delete with a body:

def delete(self, endpoint, timeout=None, allow_redirects=None, validate=True):

asyrjasalo commented 6 years ago

Thanks for submitting an issue. This currently works as it is by design, basing on the REST best practices. Although sending body in DELETE is not explicitly forbidden, it is not recommended.

According to RFC 7231, "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content":

A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request.

Please create a new issue describing the real-world use-case, that possibly needs this to be compromised. For discussion on the topic, see e.g. Stack Overflow discussion on Is an entity body allowed for an HTTP DELETE request?.