summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Hernandez <[email protected]>2018-10-03 01:49:13 +0200
committerMarcel Hernandez <[email protected]>2018-10-03 01:49:13 +0200
commitfdd71090934ee0599fa6da405646d33a88a107f9 (patch)
tree3e38904a94daff4203f50ed8407700f268def7f2 /src
parent70b4b0075a8a28ec802cc527fb56723765dd0ea0 (diff)
feedback from code review
Diffstat (limited to 'src')
-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,