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');