public function patch($url, $data = array())
{
if (is_array($url)) {
$data = $url;
$url = $this->baseUrl;
}
if (is_array($data) && empty($data)) {
$this->removeHeader('Content-Length');
}
$this->setUrl($url);
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH');
$this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
return $this->exec();
}
public function testPatchRequestMethodWithMultidimArray() { $data = array('data' => array('foo' => 'bar', 'wibble' => 'wubble')); $curl = new Curl(); $curl->setHeader('X-DEBUG-TEST', 'data_values'); $curl->patch(Test::TEST_URL, $data); $this->assertEquals('{"data":{"foo":"bar","wibble":"wubble"}}', $curl->rawResponse); $this->assertEquals(json_decode(json_encode($data), false), $curl->response); }