From b6982ffb46fc94c8a8806c9a34c07c06fcb5ead6 Mon Sep 17 00:00:00 2001 From: php-curl-class Date: Tue, 20 Aug 2013 16:26:09 -0700 Subject: [PATCH] Send DELETE data was GET variables; Add DELETE test --- Curl.class.php | 3 +-- tests/run.php | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Curl.class.php b/Curl.class.php index dfd38f5..5959c56 100644 --- a/Curl.class.php +++ b/Curl.class.php @@ -42,9 +42,8 @@ class Curl { } function delete($url, $data=array()) { - $this->setopt(CURLOPT_URL, $url); + $this->setopt(CURLOPT_URL, $url . '?' . http_build_query($data)); $this->setopt(CURLOPT_CUSTOMREQUEST, 'DELETE'); - $this->setopt(CURLOPT_POSTFIELDS, $data); $this->_exec(); } diff --git a/tests/run.php b/tests/run.php index 4e14f42..19d54c4 100644 --- a/tests/run.php +++ b/tests/run.php @@ -47,6 +47,11 @@ class CurlTest extends PHPUnit_Framework_TestCase { $this->assertTrue($test->server('POST', 'post', 'test') === 'post'); } + public function testDelete() { + $test = new Test(); + $this->assertTrue($test->server('DELETE', 'server', 'REQUEST_METHOD') === 'DELETE'); + } + public function testBasicHttpAuth() { $test = new Test(); $this->assertTrue($test->server('GET', 'http_basic_auth') === 'canceled');