Skip to content

fix: treat HTTP 404 on DELETE as success (idempotent delete)#834

Open
smithimage wants to merge 1 commit intoAzure:mainfrom
smithimage:fix/delete-resource-ignore-404
Open

fix: treat HTTP 404 on DELETE as success (idempotent delete)#834
smithimage wants to merge 1 commit intoAzure:mainfrom
smithimage:fix/delete-resource-ignore-404

Conversation

@smithimage
Copy link

When the publisher tries to delete a resource that has already been removed from APIM (e.g. a manually deleted API revision), the DELETE call returns HTTP 404. Previously, DeleteResource threw an exception on any error response including 404, causing the entire publisher pipeline to crash.

This change makes DeleteResource ignore 404 responses on DELETE, treating them as successful — the resource is already gone, which is the desired end state. This follows the REST convention of idempotent deletes and is consistent with how GetContentOption already handles 404 for GET requests.

The fix applies to all resource types (ApiTag, Api, Backend, Logger, Diagnostic, etc.) since they all call DeleteResource.

When the publisher tries to delete a resource that has already been
removed from APIM (e.g. a manually deleted API revision), the DELETE
call returns HTTP 404. Previously, DeleteResource threw an exception
on any error response including 404, causing the entire publisher
pipeline to crash.

This change makes DeleteResource ignore 404 responses on DELETE,
treating them as successful — the resource is already gone, which is
the desired end state. This follows the REST convention of idempotent
deletes and is consistent with how GetContentOption already handles
404 for GET requests.

The fix applies to all resource types (ApiTag, Api, Backend, Logger,
Diagnostic, etc.) since they all call DeleteResource.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants