mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 04:01:47 +00:00
Fix #95: Allow json data with PUT requests
This commit is contained in:
+1
-1
@@ -134,7 +134,7 @@ class Curl
|
||||
$this->url = $url;
|
||||
$this->setOpt(CURLOPT_URL, $this->url);
|
||||
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
|
||||
$put_data = http_build_query($data);
|
||||
$put_data = $this->postfields($data);
|
||||
if (empty($this->options[CURLOPT_INFILE]) && empty($this->options[CURLOPT_INFILESIZE])) {
|
||||
$this->setHeader('Content-Length', strlen($put_data));
|
||||
}
|
||||
|
||||
@@ -269,6 +269,11 @@ class CurlTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('key=value', $test->server('put', 'PUT', array(
|
||||
'key' => 'value',
|
||||
)));
|
||||
|
||||
$test = new Test();
|
||||
$this->assertEquals('{"key":"value"}', $test->server('put', 'PUT', json_encode(array(
|
||||
'key' => 'value',
|
||||
))));
|
||||
}
|
||||
|
||||
public function testPutFileHandle()
|
||||
|
||||
Reference in New Issue
Block a user