Skip to content

Commit 791c570

Browse files
committed
Stop using HttpResponse::stream method
1 parent 2f6755b commit 791c570

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

src/Core/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
## NOT RELEASED
44

5+
### Fixed
6+
7+
- Buffer the response in temporary file to avoid issues when stream is used by another request's body
8+
59
## 1.27.1
610

711
### Fixed
812

9-
- SignerV4: fix sort of query parameters to build correct canoncal query string
13+
- SignerV4: fix sort of query parameters to build correct canoncal query string
1014

1115
## 1.27.0
1216

src/Core/src/Response.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,6 @@ public function toStream(): ResultStream
369369
{
370370
$this->resolve();
371371

372-
if (\is_callable([$this->httpResponse, 'toStream'])) {
373-
return new ResponseBodyResourceStream($this->httpResponse->toStream());
374-
}
375-
376372
if ($this->streamStarted) {
377373
throw new RuntimeException('Can not create a ResultStream because the body started being downloaded. The body was started to be downloaded in Response::wait()');
378374
}

src/Service/S3/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Fixed
6+
7+
- Add test to ensure a response's body can be streamed to another request's body.
8+
59
### BC-BREAK
610

711
- AWS api-change: Expires's property and its getters/setters switched from `\DateTimeImmutable` to `string`.

src/Service/S3/tests/Integration/S3ClientTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,25 @@ public function testUploadPartCopy(): void
10081008
self::assertEquals(200, $result->info()['status']);
10091009
}
10101010

1011+
public function testStreamToStream(): void
1012+
{
1013+
$client = $this->getClient();
1014+
1015+
$client->putObject([
1016+
'Bucket' => 'foo',
1017+
'Key' => 'bar',
1018+
'Body' => 'content',
1019+
])->resolve();
1020+
1021+
$client->putObject([
1022+
'Bucket' => 'foo',
1023+
'Key' => 'bar2',
1024+
'Body' => $client->getObject(['Bucket' => 'foo', 'Key' => 'bar'])->getBody()->getContentAsResource(),
1025+
])->resolve();
1026+
1027+
self::expectNotToPerformAssertions();
1028+
}
1029+
10111030
private function getClient(): S3Client
10121031
{
10131032
return new S3Client([

0 commit comments

Comments
 (0)