ZF-10162: Zend_Rest_Client

Issue Type: Bug Created: 2010-07-15T05:13:56.000+0000 Last Updated: 2011-07-28T09:20:44.000+0000 Status: Resolved Fix version(s): - 1.11.10 (04/Aug/11)

Reporter: nikola chochkov (nchochkov) Assignee: Bart McLeod ( Tags: - Zend_Rest_Client

Related issues: - ZF-11030



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


Posted by Ryan Mauger (bittarman) on 2010-07-15T05:27:17.000+0000

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.

Posted by nikola chochkov (nchochkov) on 2010-07-15T06:22:07.000+0000


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..

Posted by Justin Woods (justinw) on 2010-08-03T16:18:45.000+0000

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

Posted by Sergey Romanov (serhioromano) on 2011-05-23T07:25:45.000+0000

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?

Posted by Bart McLeod ( on 2011-07-21T09:05:58.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.