Connexion: Why DELETE operation doesn't support request body argument?

Created on 5 Mar 2019  路  3Comments  路  Source: zalando/connexion

https://github.com/zalando/connexion/blob/34c7cb160fec372d386a0daa139df2a568b01ac8/connexion/operations/abstract.py#L273

Hi,
Is there a reason why DELETE verb doesn't support request body in version 2.2.0?
In version 1.1.15 I was able to send request body as a parameter.

Python version:
3.6.7
connexion version:
2.2.0

Thanks!

Most helpful comment

I see, thanks for the explanation!
I think it should at least be configurable since this was working on earlier versions.
anyway I can workaround this using:

request = connexion.request.json

All 3 comments

The spec says that the URI should be sufficient to perform the delete operation.

The DELETE method requests that the origin server delete the resource identified by the Request-URI

It isn't expressly forbidden to include a request body, but it is generally accepted that you do not. I Feel that this is the same reason why here.

I see, thanks for the explanation!
I think it should at least be configurable since this was working on earlier versions.
anyway I can workaround this using:

request = connexion.request.json

A more recent RFC is more explicit on payload behavior:
https://tools.ietf.org/html/rfc7231#section-4.3.5

A payload within a DELETE request message has no defined semantics;

The link was provided from this Stackoverflow question:
https://stackoverflow.com/questions/299628/is-an-entity-body-allowed-for-an-http-delete-request

I have rarely seen a body in delete, the only example I have in mind is this one:
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#delete-job-v1-batch

When we delete a Kubernetes job, we can mention some delete options.

Even if it is accepted that we do not, it could make sense to allow it in the framework?

Was this page helpful?
0 / 5 - 0 ratings