From 110ee04244ffe633cdf6ac106d13bf4cda4078f4 Mon Sep 17 00:00:00 2001 From: Robert Petreski Date: Tue, 22 Dec 2015 09:14:19 +1100 Subject: [PATCH] Updated RestfulService to include PATCH RestfulService now allows PATCH and also removed CURLOPT_POST --- api/RestfulService.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/RestfulService.php b/api/RestfulService.php index ac5ef31eb..517459976 100644 --- a/api/RestfulService.php +++ b/api/RestfulService.php @@ -171,7 +171,7 @@ class RestfulService extends ViewableData implements Flushable { $url = $this->getAbsoluteRequestURL($subURL); $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( $url, @@ -259,8 +259,7 @@ class RestfulService extends ViewableData implements Flushable { if($this->authUsername) curl_setopt($ch, CURLOPT_USERPWD, $this->getBasicAuthString()); // Add fields to POST and PUT requests - if($method == 'POST') { - curl_setopt($ch, CURLOPT_POST, 1); + if($method == 'POST' || $method == 'PATCH') { curl_setopt($ch, CURLOPT_POSTFIELDS, $data); } elseif($method == 'PUT') { $put = fopen("php://temp", 'r+');