Fix #53: Return response body when calling HTTP request methods

This commit is contained in:
Zach Borboa
2014-06-24 18:48:36 -07:00
parent 85e4109f6a
commit 54a3dd5edc
3 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -433,7 +433,7 @@ class Curl
$ch->call($this->complete_function, $ch);
return $ch->error_code;
return $ch->response;
}
private function call($function)
+9
View File
@@ -305,6 +305,15 @@ class CurlTest extends PHPUnit_Framework_TestCase
)) === 'myreferrer');
}
public function testResponseBody()
{
foreach (array('GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS') as $request_method) {
$curl = new Curl();
$curl->setHeader('X-DEBUG-TEST', 'response_body');
$this->assertTrue($curl->$request_method(Test::TEST_URL) === 'OK');
}
}
public function testCookies()
{
$test = new Test();
+3
View File
@@ -79,6 +79,9 @@ if ($test == 'http_basic_auth') {
header('Content-Type: application/json');
header('ETag: ' . md5('worldpeace'));
exit;
} elseif ($test === 'response_body') {
echo 'OK';
exit;
} elseif ($test === 'json_response') {
$key = $_POST['key'];
$value = $_POST['value'];