Issues

ZF-10162: Zend_Rest_Client

Description

An existing API is based on Zend_Rest_Controller and a separate zend application (1.10.6) connects to it using Zend_Rest_Client.

When an array is passed as a second argument to Zend_Rest_Client::restPut($path, $data) I get this exception instead of the expected response from my server app.

Message: Cannot handle content type '' automatically. Please use Zend_Http_Client::setRawData to send this kind of content.

Stack trace:

0 /web/b2c_bank/library/Zend/Http/Client.php(957): Zend_Http_Client->_prepareBody()

1 /web/b2c_bank/library/Zend/Rest/Client.php(159): Zend_Http_Client->request('PUT')

2 /web/b2c_bank/library/Zend/Rest/Client.php(187): Zend_Rest_Client->_performPost('PUT', Array)

3 /web/b2c_bank/library/My/Service/Rest/ClientCore.php(48): Zend_Rest_Client->restPut('/api/', Array)

p.s. all other REST methods (GET, DELETE, POST) work fine in the same configuration

Comments

exactly what data is in $path, and $data? You need to provide enough data to be able to reproduce this in order that it can be fix, if there is indeed a bug.

If this is a support request, please close this and direct your support requests to either the mailing list, or #zftalk on Freenode IRC.

Hello,

Here is what happens:

    $data = array('var' => 'text', 'num' => 1);
    // path to rest controller with a putAction(){}
    $path = '/core/public/rest';
    $client = new Zend_Rest_Client('<a rel="nofollow" href="http://localhost:8888">http://localhost:8888</a>');
    return = $client->restPut($path,$data);

this also produces the exception I'm talking about. Like I said, exactly the same setting works for me fine on POST for example..

I'm having the same problem as Nikola. Attempting to PUT via Zend_Rest_Client.

I have the same issue

$rest = new Zend_Rest_Client('http://localhost'); $rest->getHttpClient()->setHeaders('apikey','0274895'); $result = $rest->restPut('/angeldesk-web-service/public/V1/topics/19', array('user_id' => 1)); var_dump($result->getBody());

Stack trace:

0 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Http\Client.php(961): Zend_Http_Client->_prepareBody()

1 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Rest\Client.php(159): Zend_Http_Client->request('PUT')

2 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Rest\Client.php(187): Zend_Rest_Client->_performPost('PUT', Array)

If i do not put array to restPut() it works. But how am i going to path aditional params?

This is a duplicate of ZF-11030, which I have patched.