Skip to content

Commit f7067ae

Browse files
committed
Check body for string
1 parent b29eb03 commit f7067ae

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Common/Http/Client.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ private function getStreamFactory() : StreamFactoryInterface
7070
* @param $method
7171
* @param $uri
7272
* @param array $headers
73-
* @param string|array|resource|StreamInterface|null $body
73+
* @param string|null $body
7474
* @param string $protocolVersion
7575
* @return ResponseInterface
76-
* @throws \Http\Client\Exception
76+
* @throws NetworkException|RequestException
7777
*/
7878
public function request(
7979
$method,
@@ -86,9 +86,9 @@ public function request(
8686
->createRequest($method, $uri)
8787
->withProtocolVersion($protocolVersion);
8888

89-
if ($body) {
90-
$stream = $this->getStreamFactory()->createStream($body);
91-
$request = $request->withBody($stream);
89+
if ($body !== null && $body !== '' && is_string($body)) {
90+
$body = $this->getStreamFactory()->createStream($body);
91+
$request = $request->withBody($body);
9292
}
9393

9494
foreach ($headers as $name => $value) {

0 commit comments

Comments
 (0)