fix: treat HTTP 404 on DELETE as success (idempotent delete) by smithimage · Pull Request #834 · Azure/apiops

@VDRobert

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>