Skip to content

Commit

Permalink
Merge pull request #41 from bstoney/aws-v3-config
Browse files Browse the repository at this point in the history
Fixed passing request options to AWS S3v3 client
  • Loading branch information
basz authored Jul 19, 2018
2 parents 12e861d + 88a5c5a commit 83d8f3a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Adapter/Factory/AwsS3v3AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function doCreateService(ServiceLocatorInterface $serviceLocator): Adapte
$config = [
'region' => $this->options['region'],
'version' => $this->options['version'],
'request.options' => $this->options['request.options'],
'http' => $this->options['request.options'],
];

// Override the endpoint for example: when using an s3 compatible host
Expand Down
29 changes: 29 additions & 0 deletions test/Adapter/Factory/AwsS3v3AdapterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,33 @@ public function validateConfigProvider(): array
],
];
}

public function testCreateServiceWithRequestOptions()
{
$this->markTestSkipped('Skipped because Aws3Sv2 and Aws3Sv3 are not compatible.');

$options = [
'credentials' => [
'key' => 'abc',
'secret' => 'def',
],
'region' => 'ghi',
'bucket' => 'jkl',
'request.options' => [
'timeout' => 1,
],
];

$sm = Bootstrap::getServiceManager();
$factory = new AwsS3v3AdapterFactory($options);

/** @var \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter */
$adapter = $factory($sm, 'awss3_default');

/** @var \Aws\Command $command */
$command = $adapter->getClient()->getCommand('GetObject');

self::assertTrue($command->hasParam('@http'));
self::assertEquals(['timeout' => 1], $command['@http']);
}
}

0 comments on commit 83d8f3a

Please sign in to comment.