ZF2-57: Zend\Http\Client does not switch method to POST when you have used setParameterPost

Issue Type: Bug Created: 2011-09-02T11:46:26.000+0000 Last Updated: 2011-12-21T22:49:12.000+0000 Status: Closed Fix version(s): Reporter: Gary Hockin (spabby) Assignee: Fabio B. Silva (fabio.bat.silva) Tags: - Zend\Http

Related issues: Attachments:


When using Zend\Http\Client to post to a 3rd party API, I would expect the action of doing a setParameterPost would automatically switch the send method to Request::METHOD_POST, so that I can just then send the request. This is easily done by modifying the setParameterPost function as follows:

<pre class="highlight">
    public function setParameterPost(array $post)
        return $this;

The setParameterGet funciton would also need to be modified as follows:

<pre class="highlight">
    public function setParameterGet(array $query)
        return $this;

This has been the case since Zend_Http in ZF1, there may be unseen use cases that mean this is a design decision, and not an improvement, if so, I humbly apologise :D.


Posted by Matthew Weier O'Phinney (matthew) on 2011-11-23T14:16:26.000+0000

I'm not entirely sure this makes sense.

You can have query parameters while still doing a POST request -- or even a DELETE or HEAD. Additionally, you may set the POST parameters when doing a PUT request. To me, auto-setting this would introduce a WTF factor if I were doing any of those operations.

Posted by Ben Scholzen (dasprid) on 2011-12-01T00:20:18.000+0000

I agree with Matthew there, even if it looks convenient for setParameterPost in the first place, for setParameterGet it can totally screw some requests.

Posted by Evan Coury ( on 2011-12-21T22:49:12.000+0000

I'm going to go ahead and close this issue as Won't Fix... I don't see something like this doing any good, really.

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.