Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/zendframework/zendframework#6959-set-correct-enc…
Browse files Browse the repository at this point in the history
…oding-in-http-client-when-sending'

Close zendframework/zendframework#6959
  • Loading branch information
Ocramius committed Dec 16, 2014
2 parents c7dd86c + adf1a60 commit 71f5cac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
16 changes: 16 additions & 0 deletions test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit 71f5cac

Please sign in to comment.