Make all API `DELETE` endpoints return `204` and respect the `If-Unmodified-Since` header in GitLab 9.0
Quoting @grzesiek here:
As per RFC 7231, page 30:
If a DELETE method is successfully applied, the origin server SHOULD send a 202 (Accepted) status code if the action will likely succeed but has not yet been enacted, a 204 (No Content) status code if the action has been enacted and no further information is to be supplied, or a 200 (OK) status code if the action has been enacted and the response message includes a representation describing the status.
In RFC 2616:
A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity.
I think we should always return 204
(no content) for successful DELETE
API requests to simplify things and be consistent about this throughout the API.
The reason for not returning any content is that if you decide to issue a DELETE
request, it means you know the content of the resource you're about to destroy so there's no need to return the just-destroyed resource.
Also, by returning a resource that you asked to destroy, there's still a doubt that the resource was actually destroyed. By returning no content and a 204
status, there's no doubt.