Skip to content

Commit

Permalink
Merge pull request aws#432 from aws/duplicate_querystring
Browse files Browse the repository at this point in the history
Query string value lists are serialized as duplicates
  • Loading branch information
mtdowling committed Dec 11, 2014
2 parents 4c593b5 + ef7779c commit 44a1acf
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/Aws/Common/Client/AbstractClient.php
Expand Up @@ -31,6 +31,7 @@
use Aws\Common\Waiter\WaiterConfigFactory;
use Guzzle\Common\Collection;
use Guzzle\Http\Exception\CurlException;
use Guzzle\Http\QueryAggregator\DuplicateAggregator;
use Guzzle\Service\Client;
use Guzzle\Service\Description\ServiceDescriptionInterface;

Expand All @@ -39,21 +40,18 @@
*/
abstract class AbstractClient extends Client implements AwsClientInterface
{
/**
* @var CredentialsInterface AWS credentials
*/
/** @var CredentialsInterface AWS credentials */
protected $credentials;

/**
* @var SignatureInterface Signature implementation of the service
*/
/** @var SignatureInterface Signature implementation of the service */
protected $signature;

/**
* @var WaiterFactoryInterface Factory used to create waiter classes
*/
/** @var WaiterFactoryInterface Factory used to create waiter classes */
protected $waiterFactory;

/** @var DuplicateAggregator Cached query aggregator*/
protected $aggregator;

/**
* {@inheritdoc}
*/
Expand All @@ -78,6 +76,7 @@ public function __construct(CredentialsInterface $credentials, SignatureInterfac
parent::__construct($config->get(Options::BASE_URL), $config);
$this->credentials = $credentials;
$this->signature = $signature;
$this->aggregator = new DuplicateAggregator();

// Make sure the user agent is prefixed by the SDK version
$this->setUserAgent('aws-sdk-php2/' . Aws::VERSION, true);
Expand Down Expand Up @@ -269,4 +268,21 @@ public function send($requests)
throw $wrapped;
}
}

/**
* Ensures that the duplicate query string aggregator is used so that
* query string values are sent over the wire as foo=bar&foo=baz.
* {@inheritdoc}
*/
public function createRequest(
$method = 'GET',
$uri = null,
$headers = null,
$body = null,
array $options = array()
) {
$request = parent::createRequest($method, $uri, $headers, $body, $options);
$request->getQuery()->setAggregator($this->aggregator);
return $request;
}
}

0 comments on commit 44a1acf

Please sign in to comment.