Is the response body allowed for the HTTP DELETE request?

I assume that the 200 response code always resolves the response body, but I cannot find explicit mention of the responder bodies for DELETE requests.

+61
Jul 05 2018-11-11T00:
source share
2 answers

Explicitly mentioned here in the RFC

Short answer:

You must include a response body with an entity describing the deleted item / resource if you return 200 .

202 is something like the status of an asynchronous request / response.

204 explicitly says that you are not including the response body

+103
Jul 05 '11 at 10:40
source

Yes, you should usually respond with a 200 response code according to the W3C specification :

9.7 REMOVE

The DELETE method requests that the source server remove the resource identified by the Request-URI. This method MAY be overridden by intervention (or other means) on the source server. The client cannot be that the operation was performed, even if the status code returned from the origin server indicates that the action was completed successfully. However, the server SHOULD not indicate success if, at the time of the response, this is intended, it intends to delete the resource or move it to an inaccessible location, etc.

A successful response MUST be 200 (OK) if the response includes an object that describes the status, 202 (Accepted) if the action has not yet been taken, or 204 (without content) if the action was taken, but the response does not include the object.

If the request passes through the cache and the Request-URI identifies one or currently cached objects, those records MUST be deprecated. Responses to this method are not cached.

+13
Jul 05 '11 at 10:40
source



All Articles