Reputation: 239
I have a REST DELETE call done. After deleting , I am verifying the same url with GET Rest call.
Expected result : it should throw - 404 err which is valid as data dosent exists . Current result- 200 - where even after delete , the data exists !!!
please let me know , does REST DELETE API uses any delay to get reflected ?
Upvotes: 0
Views: 991
Reputation: 7744
The specification for DELETE at https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html states:
9.7 DELETE
The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.
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.
If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.
So basically it says the server is under no obligation to immediately delete the resource, only to indicate intent. Even though a "nice" server would then return 202 (Accepted) to indicate the delay. Did it do that by any chance?
Upvotes: 1