Skip to content

Commit ed8dbc0

Browse files
committed
BUGFIX: withMethods return altered object
1 parent 79524bc commit ed8dbc0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Classes/Transfer/RequestService.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,19 @@ public function request($method, ElasticSearchClient $client, ?string $path = nu
9191
if ($path !== null) {
9292
if (strpos($path, '?') !== false) {
9393
list($path, $query) = explode('?', $path);
94-
$uri->withQuery($query);
94+
$uri = $uri->withQuery($query);
9595
}
96-
$uri->withPath($uri->getPath() . $path);
96+
$uri = $uri->withPath($uri->getPath() . $path);
9797
}
9898

9999
$request = $this->requestFactory->createServerRequest($method, $uri);
100100

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

106-
$request->withHeader('Content-Type', 'application/json');
106+
$request = $request->withHeader('Content-Type', 'application/json');
107107
$response = $this->browser->sendRequest($request);
108108

109109
return new Response($response, $this->browser->getLastRequest());

0 commit comments

Comments
 (0)