Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.10.2
-
Fix Version/s: 1.11.10
-
Component/s: Zend_Rest_Client
-
Labels:None
Description
With current (v1.10.2) implementation of Zend_Rest_Client::restDelete(), you cannot add any query parameters to queried url.
For instance, if I want to delete item with id=1, I did not find how to end up with my-delete-url?id=1.
This is very very very useful (not everybody use friendly urls / url-mapping|rewriting)
I slightly modified the function so that it behaves as restGet, restPost and restPut.
source
/**
* Performs an HTTP DELETE request to $path.
*
* @param string $path
* @throws Zend_Http_Client_Exception
* @return Zend_Http_Response
*/
final public function restDelete($path)
{
$this->_prepareRest($path);
return self::getHttpClient()->request('DELETE');
}
target
/**
* Performs an HTTP DELETE request to $path.
*
* @param string $path
* @param array $query Array of GET parameters
* @throws Zend_Http_Client_Exception
* @return Zend_Http_Response
*/
final public function restDelete($path, $query = null)
{
$this->_prepareRest($path);
$client = self::getHttpClient();
$client->setParameterGet($query);
return $client->request('DELETE');
}
Regards,
Remy
diff file against v1.10.2 allowing restDelete() to accept query arguments