Skip to content

Commit 8de87f0

Browse files
authored
Merge pull request #26 from jeanmatthieud/body-stream
[FIX] Accept stream body #25
2 parents 06dce8d + c7e65ab commit 8de87f0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ApiCall.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Http\Client\Exception as HttpClientException;
77
use Http\Client\Exception\HttpException;
88
use Http\Client\HttpClient;
9+
use Psr\Http\Message\StreamInterface;
910
use Psr\Log\LoggerInterface;
1011
use Typesense\Exceptions\HTTPStatus0Error;
1112
use Typesense\Exceptions\ObjectAlreadyExists;
@@ -202,7 +203,7 @@ private function makeRequest(string $method, string $endPoint, bool $asJson, arr
202203
$url = $node->url() . $endPoint;
203204
$reqOp = $this->getRequestOptions();
204205
if (isset($options['data'])) {
205-
if (is_string($options['data'])) {
206+
if (is_string($options['data']) || $options['data'] instanceof StreamInterface) {
206207
$reqOp['body'] = $options['data'];
207208
} else {
208209
$reqOp['body'] = \json_encode($options['data']);

0 commit comments

Comments
 (0)