diff --git a/src/Client.php b/src/Client.php index 29d04fd84a..d40a3382fb 100644 --- a/src/Client.php +++ b/src/Client.php @@ -863,6 +863,9 @@ public function send(Request $request = null) // method $method = $this->getRequest()->getMethod(); + // this is so the correct Encoding Type is set + $this->setMethod($method); + // body $body = $this->prepareBody(); diff --git a/test/ClientTest.php b/test/ClientTest.php index 6a874982ad..bd18fa283f 100644 --- a/test/ClientTest.php +++ b/test/ClientTest.php @@ -406,4 +406,20 @@ public function testHttpQueryParametersCastToString() $client->send($request); } + + /** + * @group 6959 + */ + public function testClientRequestMethod() + { + $request = new Request; + $request->setMethod(Request::METHOD_POST); + $request->getPost()->set('data', 'random'); + + $client = new Client; + $client->setAdapter('Zend\Http\Client\Adapter\Test'); + $client->send($request); + + $this->assertSame(Client::ENC_URLENCODED, $client->getEncType()); + } }