Skip to content

Commit f6a2ec0

Browse files
committed
BUGFIX: Always deliver a string to createStream
1 parent cb181ce commit f6a2ec0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Classes/Transfer/RequestService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ public function request($method, ElasticSearchClient $client, ?string $path = nu
100100
$request = $this->requestFactory->createServerRequest($method, $uri);
101101

102102
// In some cases, $content will contain "null" as a string. Better be safe and handle this weird case:
103-
if ($content !== 'null') {
104-
$request = $request->withBody($this->contentStreamFactory->createStream((is_array($content) ? json_encode($content) : $content)));
103+
if ($content !== 'null' && $content !== null) {
104+
$request = $request->withBody($this->contentStreamFactory->createStream(is_array($content) ? json_encode($content) : (string)$content));
105105
}
106106

107107
$request = $request->withHeader('Content-Type', 'application/json');

0 commit comments

Comments
 (0)