mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Updated RestfulService to include PATCH
RestfulService now allows PATCH and also removed CURLOPT_POST
This commit is contained in:
parent
880a3ef0ab
commit
110ee04244
@ -171,7 +171,7 @@ class RestfulService extends ViewableData implements Flushable {
|
|||||||
$url = $this->getAbsoluteRequestURL($subURL);
|
$url = $this->getAbsoluteRequestURL($subURL);
|
||||||
$method = strtoupper($method);
|
$method = strtoupper($method);
|
||||||
|
|
||||||
assert(in_array($method, array('GET','POST','PUT','DELETE','HEAD','OPTIONS')));
|
assert(in_array($method, array('GET','POST','PUT','DELETE','HEAD','OPTIONS','PATCH')));
|
||||||
|
|
||||||
$cache_path = $this->getCachePath(array(
|
$cache_path = $this->getCachePath(array(
|
||||||
$url,
|
$url,
|
||||||
@ -259,8 +259,7 @@ class RestfulService extends ViewableData implements Flushable {
|
|||||||
if($this->authUsername) curl_setopt($ch, CURLOPT_USERPWD, $this->getBasicAuthString());
|
if($this->authUsername) curl_setopt($ch, CURLOPT_USERPWD, $this->getBasicAuthString());
|
||||||
|
|
||||||
// Add fields to POST and PUT requests
|
// Add fields to POST and PUT requests
|
||||||
if($method == 'POST') {
|
if($method == 'POST' || $method == 'PATCH') {
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||||
} elseif($method == 'PUT') {
|
} elseif($method == 'PUT') {
|
||||||
$put = fopen("php://temp", 'r+');
|
$put = fopen("php://temp", 'r+');
|
||||||
|
Loading…
Reference in New Issue
Block a user