Avoid creation of document if deleting attachment on non-existent doc #486
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Prior to the change in this PR, one new document was unexpectedly created after a request is issued to delete attachment on non-existent document. This PR is aimed to address this to return 404 (Not Found) instead of creating new document.
Testing recommendations
The newly introduced test case
should_return_404_for_delete_att_on_notadoc
covers the steps to test the change in this PR. In addition, two additional test casesshould_return_409_for_del_att_without_rev
andshould_return_200_for_del_att_with_rev
are introduced to make sure that there is no regression.JIRA issue number
COUCHDB-3362
Related Pull Requests
N/A
Checklist
with the correct commit hash once this PR get merged.
No documentation change since the changed behavior is aligned with statement in document http:https://docs.couchdb.org/en/2.0.0/api/document/attachments.html#delete--db-docid-attname