Replace DELETE method by POST according to the Cloudflare [documentation](https://api.cloudflare.com/#zone-purge-all-files)
This commit is contained in:
@@ -217,7 +217,7 @@ class Zones implements API
|
|||||||
*/
|
*/
|
||||||
public function cachePurgeEverything(string $zoneID): bool
|
public function cachePurgeEverything(string $zoneID): bool
|
||||||
{
|
{
|
||||||
$user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', ['purge_everything' => true]);
|
$user = $this->adapter->post('zones/' . $zoneID . '/purge_cache', ['purge_everything' => true]);
|
||||||
|
|
||||||
$this->body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ class Zones implements API
|
|||||||
$options['hosts'] = $hosts;
|
$options['hosts'] = $hosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', $options);
|
$user = $this->adapter->post('zones/' . $zoneID . '/purge_cache', $options);
|
||||||
|
|
||||||
$this->body = json_decode($user->getBody());
|
$this->body = json_decode($user->getBody());
|
||||||
|
|
||||||
|
|||||||
@@ -194,10 +194,10 @@ class ZonesTest extends TestCase
|
|||||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurgeEverything.json');
|
$response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurgeEverything.json');
|
||||||
|
|
||||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||||
$mock->method('delete')->willReturn($response);
|
$mock->method('post')->willReturn($response);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('delete')
|
->method('post')
|
||||||
->with(
|
->with(
|
||||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
|
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
|
||||||
$this->equalTo(['purge_everything' => true])
|
$this->equalTo(['purge_everything' => true])
|
||||||
@@ -215,10 +215,10 @@ class ZonesTest extends TestCase
|
|||||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurgeHost.json');
|
$response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurgeHost.json');
|
||||||
|
|
||||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||||
$mock->method('delete')->willReturn($response);
|
$mock->method('post')->willReturn($response);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('delete')
|
->method('post')
|
||||||
->with(
|
->with(
|
||||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
|
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
|
||||||
$this->equalTo(
|
$this->equalTo(
|
||||||
@@ -242,10 +242,10 @@ class ZonesTest extends TestCase
|
|||||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurge.json');
|
$response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurge.json');
|
||||||
|
|
||||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||||
$mock->method('delete')->willReturn($response);
|
$mock->method('post')->willReturn($response);
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('delete')
|
->method('post')
|
||||||
->with(
|
->with(
|
||||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
|
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
|
||||||
$this->equalTo(['files' => [
|
$this->equalTo(['files' => [
|
||||||
|
|||||||
Reference in New Issue
Block a user