Issues

ZF2-78: Http\Client throws RuntimeException when passed additional Encoding info.

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

  • charset
  • x-www-form-urlencoded,

Related issues: Attachments:

Description

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

Comments

Posted by Kazusuke Sasezaki (sasezaki) on 2011-10-27T13:20:06.000+0000

patch is merged https://github.com/zendframework/zf2/pull/533

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts