File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ class MailchimpRequest
8282
8383 /**
8484 * The payload that is serialized and sent
85- * @var array
85+ * @var object
8686 */
8787 private $ payload ;
8888
@@ -118,6 +118,7 @@ class MailchimpRequest
118118 public function __construct ($ apikey = null )
119119 {
120120 if (!$ apikey ) {
121+ $ this ->setHeaders ([]);
121122 return ;
122123 }
123124
@@ -200,9 +201,13 @@ public function getValidMethods()
200201 /**
201202 * Get the headers
202203 * @return array
204+ * @throws MailchimpException
203205 */
204206 public function getHeaders ()
205207 {
208+ if (!is_array ($ this ->headers )) {
209+ throw new MailchimpException ("Request headers must be of type array " );
210+ }
206211 return $ this ->headers ;
207212 }
208213
@@ -423,6 +428,9 @@ public function reset()
423428 $ request_vars = get_object_vars ($ this );
424429 foreach ($ request_vars as $ key => $ value ) {
425430 $ this ->$ key = null ;
431+ if ($ key == 'headers ' ) {
432+ $ this ->$ key = [];
433+ }
426434 }
427435 self ::__construct ($ apikey );
428436 }
You can’t perform that action at this time.
0 commit comments