Send DELETE data was GET variables; Add DELETE test

This commit is contained in:
php-curl-class
2013-08-20 16:26:09 -07:00
parent 94982c6450
commit b6982ffb46
2 changed files with 6 additions and 2 deletions
+1 -2
View File
@@ -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();
}
+5
View File
@@ -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');