summaryrefslogtreecommitdiff
path: root/src/PSR7Client.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/PSR7Client.php')
-rw-r--r--src/PSR7Client.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/PSR7Client.php b/src/PSR7Client.php
index b12159a5..7000018e 100644
--- a/src/PSR7Client.php
+++ b/src/PSR7Client.php
@@ -107,10 +107,7 @@ class PSR7Client
if ($ctx['parsed']) {
$request = $request->withParsedBody(json_decode($body, true));
} else if ($body !== null) {
- $bodyStream = $this->streamFactory->createStream($body);
- $bodyStream->write($body);
-
- $request = $request->withBody($bodyStream);
+ $request = $request->withBody($this->streamFactory->createStream($body));
}
return $request;
@@ -172,9 +169,11 @@ class PSR7Client
continue;
}
- $stream = UPLOAD_ERR_OK === $f['error'] ?
- $this->streamFactory->createStreamFromFile($f['tmpName']) :
- $this->streamFactory->createStream();
+ if (UPLOAD_ERR_OK === $f['error']) {
+ $stream = $this->streamFactory->createStreamFromFile($f['tmpName']);
+ } else {
+ $stream = $this->streamFactory->createStream();
+ }
$result[$index] = $this->uploadsFactory->createUploadedFile(
$stream,