diff --git a/src/Aws/Common/Client/AbstractClient.php b/src/Aws/Common/Client/AbstractClient.php index c9ee86a66f..63a46832f7 100644 --- a/src/Aws/Common/Client/AbstractClient.php +++ b/src/Aws/Common/Client/AbstractClient.php @@ -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; @@ -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} */ @@ -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); @@ -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; + } }