Skip to content

Commit

Permalink
chore: use same attributes of the transport class
Browse files Browse the repository at this point in the history
  • Loading branch information
imdhemy committed Mar 2, 2024
1 parent eee6da0 commit 392369c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/OpenSearch/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1394,10 +1394,12 @@ public function extractArgument(array &$params, string $arg)
public function request(
string $method,
string $uri,
array $params = [],
$body = null,
array $options = []
array $attributes = []
) {
$params = $attributes['params'] ?? [];
$body = $attributes['body'] ?? null;
$options = $attributes['options'] ?? [];

$promise = $this->transport->performRequest($method, $uri, $params, $body, $options);

return $this->transport->resultOrFuture($promise, $options);
Expand Down
4 changes: 2 additions & 2 deletions tests/ClientIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function sendRawPostRequest(): void
$index = 'test_index_' . time();
$client->indices()->create(['index' => $index]);

$response = $client->request('POST', "/$index/_doc", [], ['foo' => 'bar']);
$response = $client->request('POST', "/$index/_doc", ['body' => ['foo' => 'bar']]);

$this->assertIsArray($response);
$this->assertArrayHasKey('_index', $response);
Expand All @@ -189,7 +189,7 @@ public function sendRawPutRequest(): void
$index = 'test_index_' . time();
$client->indices()->create(['index' => $index]);

$response = $client->request('PUT', "/$index/_settings", [], ['index' => ['number_of_replicas' => 2]]);
$response = $client->request('PUT', "/$index/_settings", ['body' => ['index' => ['number_of_replicas' => 2]]]);

$this->assertIsArray($response);
$this->assertArrayHasKey('acknowledged', $response);
Expand Down

0 comments on commit 392369c

Please sign in to comment.