diff --git a/src/Common/Http/Client.php b/src/Common/Http/Client.php index 4a9f53da..ef4b83a1 100644 --- a/src/Common/Http/Client.php +++ b/src/Common/Http/Client.php @@ -70,10 +70,10 @@ private function getStreamFactory() : StreamFactoryInterface * @param $method * @param $uri * @param array $headers - * @param string|array|resource|StreamInterface|null $body + * @param string|null $body * @param string $protocolVersion * @return ResponseInterface - * @throws \Http\Client\Exception + * @throws NetworkException|RequestException */ public function request( $method, @@ -86,9 +86,9 @@ public function request( ->createRequest($method, $uri) ->withProtocolVersion($protocolVersion); - if ($body) { - $stream = $this->getStreamFactory()->createStream($body); - $request = $request->withBody($stream); + if ($body !== null && $body !== '' && is_string($body)) { + $body = $this->getStreamFactory()->createStream($body); + $request = $request->withBody($body); } foreach ($headers as $name => $value) {