1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-24 18:13:00 +01:00

Merge remote-tracking branch 'davedevelopment/nested-post-with-files'

This commit is contained in:
Michael Dowling 2012-05-24 13:09:06 -07:00
commit 21e5afccbf
2 changed files with 6 additions and 3 deletions

View File

@ -108,7 +108,7 @@ class CurlHandle
// Special handling for POST specific fields and files
if (count($request->getPostFiles())) {
$fields = $request->getPostFields()->getAll();
$fields = $request->getPostFields()->urlEncode();
foreach ($request->getPostFiles() as $key => $data) {
$prefixKeys = count($data) > 1;
foreach ($data as $index => $file) {

View File

@ -695,7 +695,8 @@ class CurlHandleTest extends \Guzzle\Tests\GuzzleTestCase
'foo' => __FILE__,
));
$request->addPostFields(array(
'bar' => 'baz'
'bar' => 'baz',
'arr' => array('a' => 1, 'b' => 2),
));
$request->send();
@ -703,7 +704,9 @@ class CurlHandleTest extends \Guzzle\Tests\GuzzleTestCase
$options = $request->getParams()->get('curl.last_options');
$this->assertEquals(array(
'foo' => '@' . __FILE__ . ';type=text/x-php',
'bar' => 'baz'
'bar' => 'baz',
'arr[a]' => '1',
'arr[b]' => '2',
), $options[CURLOPT_POSTFIELDS]);
// Ensure that a Content-Length header was sent by cURL