Skip to content
← Back to activity

Public problem

MailChimp API wrapper: DELETE always reports failure (204 empty body treated as error)

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Calling $mailchimp->delete() on a resource always reported failure: $mailchimp->success() returned false and getLastError() returned an empty string, even though the delete worked server-side. Per the MailChimp API, a successful DELETE returns HTTP 204 with no JSON body, only headers. The wrapper treated an empty response body as an error, so every delete looked like a failure.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

The wrapper assumed an empty response body meant failure, but MailChimp DELETEs return 204 with no body by design. The maintainer fixed the wrapper to treat any 2xx response as success regardless of body content. Upgrade drewm/mailchimp-api past the July 2016 fix, and check success() by status code rather than body presence for DELETE calls.

Source: https://github.com/drewm/mailchimp-api/issues/109

Source: https://github.com/drewm/mailchimp-api/issues/109