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


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:

    public function setParameterPost(array $post)
        return $this;

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

    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.


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.

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

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.