Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Always return a 200 for delete operations
Browse files Browse the repository at this point in the history
This is to allow stagecraft to delete datasets that dont exist in
backdrop. As deletes are idempotent, and deleting a non existent
resource will not change the state of the underlying system it seems
appropriate to do this.
  • Loading branch information
timmow committed Jul 11, 2014
1 parent 68ee108 commit f7871d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions backdrop/write/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,8 @@ def delete_collection_by_data_set_name(data_set_name):
)
)

if not storage.data_set_exists(data_set_name):
abort(404, 'No collection exists with name "{}"'.format(data_set_name))

storage.delete_data_set(data_set_name)
if storage.data_set_exists(data_set_name):
storage.delete_data_set(data_set_name)

return jsonify(status='ok', message='Deleted {}'.format(data_set_name))

Expand Down
5 changes: 2 additions & 3 deletions features/write_api/delete_data_set.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Feature: delete_data_set
and the collection called "some-dataset" should not exist

@delete_things
Scenario: cannot delete a data-set that does not exist
Scenario: can delete a data-set that does not exist
Given I have the bearer token "dev-create-endpoint-token"
when I send a DELETE request to "/data-sets/some-dataset"
then I should get back a status of "404"
and I should get back the message "No collection exists with name "some-dataset""
then I should get back a status of "200"

0 comments on commit f7871d6

Please sign in to comment.