diff --git a/src/Endpoints/Zones.php b/src/Endpoints/Zones.php index 31cba0b7..f0e77779 100644 --- a/src/Endpoints/Zones.php +++ b/src/Endpoints/Zones.php @@ -164,11 +164,18 @@ public function cachePurge(string $zoneID, array $files = null, array $tags = nu throw new EndpointException('No files, tags or hosts to purge.'); } - $options = [ - 'files' => $files, - 'tags' => $tags, - 'hosts' => $hosts - ]; + $options = []; + if (!is_null($files)) { + $options['files'] = $files; + } + + if (!is_null($tags)) { + $options['tags'] = $tags; + } + + if (!is_null($hosts)) { + $options['hosts'] = $hosts; + } $user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', $options);