Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

## NOT RELEASED

### Fixed

- Buffer the response in temporary file to avoid issues when stream is used by another request's body

## 1.27.1

### Fixed

- SignerV4: fix sort of query parameters to build correct canoncal query string
- SignerV4: fix sort of query parameters to build correct canoncal query string

## 1.27.0

Expand Down
7 changes: 6 additions & 1 deletion src/Core/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
.EXPORT_ALL_VARIABLES:

initialize: start-docker
start-docker:
start-docker: start-docker-s3 start-docker-localstack
start-docker-localstack:
docker start async_aws_localstack && exit 0 || \
docker start async_aws_localstack-sts && exit 0 || \
docker pull localstack/localstack:3.0.0 && \
docker run -d -p 4566:4566 -e SERVICES=sts -v /var/run/docker.sock:/var/run/docker.sock --name async_aws_localstack-sts localstack/localstack:3.0.0 && \
docker run --rm --link async_aws_localstack-sts:localstack martin/wait -c localstack:4566
start-docker-s3:
docker pull asyncaws/testing-s3
docker start async_aws_s3 && exit 0 || \
docker run -d -p 4569:4569 -p 4570:4569 --name async_aws_s3 asyncaws/testing-s3

test: initialize
./vendor/bin/simple-phpunit
Expand Down
7 changes: 1 addition & 6 deletions src/Core/src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use AsyncAws\Core\Exception\LogicException;
use AsyncAws\Core\Exception\RuntimeException;
use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Stream\ResponseBodyResourceStream;
use AsyncAws\Core\Stream\ResponseBodyStream;
use AsyncAws\Core\Stream\ResultStream;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -288,7 +287,7 @@ final public static function wait(iterable $responses, ?float $timeout = null, b
* @return array{
* resolved: bool,
* body_downloaded: bool,
* response: \Symfony\Contracts\HttpClient\ResponseInterface,
* response: ResponseInterface,
* status: int,
* }
*/
Expand Down Expand Up @@ -369,10 +368,6 @@ public function toStream(): ResultStream
{
$this->resolve();

if (\is_callable([$this->httpResponse, 'toStream'])) {
return new ResponseBodyResourceStream($this->httpResponse->toStream());
}

if ($this->streamStarted) {
throw new RuntimeException('Can not create a ResultStream because the body started being downloaded. The body was started to be downloaded in Response::wait()');
}
Expand Down
39 changes: 39 additions & 0 deletions src/Core/tests/Integration/ClientTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

namespace AsyncAws\Core\Tests\Integration;

use AsyncAws\Core\Credentials\NullProvider;
use AsyncAws\S3\S3Client;
use PHPUnit\Framework\TestCase;

class ClientTest extends TestCase
{
public function testStreamToStream(): void
{
if (!class_exists(S3Client::class)) {
self::markTestSkipped('This test needs a client with waiter endpoints');
}

$client = new S3Client([
'endpoint' => 'http://localhost:4569',
'pathStyleEndpoint' => true,
], new NullProvider());

$client->createBucket(['Bucket' => 'foo'])->resolve();
$client->putObject([
'Bucket' => 'foo',
'Key' => 'bar',
'Body' => 'content',
])->resolve();

$client->putObject([
'Bucket' => 'foo',
'Key' => 'bar2',
'Body' => $client->getObject(['Bucket' => 'foo', 'Key' => 'bar'])->getBody()->getContentAsResource(),
])->resolve();

self::expectNotToPerformAssertions();
}
}
Loading