Replace DELETE method by POST according to the Cloudflare [documentation](https://api.cloudflare.com/#zone-purge-all-files)

This commit is contained in:
Nathan S
2020-06-21 14:52:11 +02:00
parent 694342f718
commit c575b3bc9b
2 changed files with 8 additions and 8 deletions

View File

@@ -217,7 +217,7 @@ class Zones implements API
*/
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());
@@ -247,7 +247,7 @@ class Zones implements API
$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());

View File

@@ -194,10 +194,10 @@ class ZonesTest extends TestCase
$response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurgeEverything.json');
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
$mock->method('delete')->willReturn($response);
$mock->method('post')->willReturn($response);
$mock->expects($this->once())
->method('delete')
->method('post')
->with(
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
$this->equalTo(['purge_everything' => true])
@@ -215,10 +215,10 @@ class ZonesTest extends TestCase
$response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurgeHost.json');
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
$mock->method('delete')->willReturn($response);
$mock->method('post')->willReturn($response);
$mock->expects($this->once())
->method('delete')
->method('post')
->with(
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
$this->equalTo(
@@ -242,10 +242,10 @@ class ZonesTest extends TestCase
$response = $this->getPsr7JsonResponseForFixture('Endpoints/cachePurge.json');
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
$mock->method('delete')->willReturn($response);
$mock->method('post')->willReturn($response);
$mock->expects($this->once())
->method('delete')
->method('post')
->with(
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'),
$this->equalTo(['files' => [