Issue Type: Bug Created: 2011-10-17T11:57:02.000+0000 Last Updated: 2011-10-27T13:20:06.000+0000 Status: Resolved Fix version(s): Reporter: Kazusuke Sasezaki (sasezaki) Assignee: Kazusuke Sasezaki (sasezaki) Tags: - Zend\Http
Related issues: Attachments:
Zend\Http\Client can't rock Content-Type. in case of "application/x-www-form-urlencoded; charset=UTF-8"
<pre class="highlight">
$client = new \Zend\Http\Client;
$client->setUri('<a href="http://example.com">http://example.com</a>');
$client->setHeaders(array(
//'Content-Type' => 'application/x-www-form-urlencoded' // Exception not throw
'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8' // throw RuntimeException
));
$client->setParameterPost(array('test' => 'foobar'));
$client->setMethod(\Zend\Http\Request::METHOD_POST);
$client->send();
(I met this error when upgrading Service\Akismet.. Akismet class uses setHeaders method as below.
<pre class="highlight">
'Content-Type' => 'application/x-www-form-urlencoded; charset=' . $this->getCharset()
Currently ZF1's Http_Client reset enctype at setMethod
<pre class="highlight">
$this->setEncType(self::ENC_URLENCODED);
So, I doubt as ZF1's lack of feature.. )
Posted by Kazusuke Sasezaki (sasezaki) on 2011-10-27T13:20:06.000+0000
patch is merged https://github.com/zendframework/zf2/pull/533