Skip to content

Commit 1eb7196

Browse files
committed
support for 204/No Content responses
1 parent bf1930d commit 1eb7196

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MailChimpAPI.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ private function makeRequest($resource, $arguments, $method) {
160160
);
161161

162162
//plain old json_decode
163-
$data = json_decode( $response->getBody() );
163+
$data = ( 204 == $response->getStatusCode() ) ? TRUE : json_decode( $response->getBody() );
164164

165-
if( $de = json_last_error() )
165+
if( empty($data) and ( $de = json_last_error() ) )
166166
throw new MailChimpAPIException(
167167
"Could not decode API response... .
168168
JSON error #{$de}: " . json_last_error_msg()

0 commit comments

Comments
 (0)