Skip to content

Commit

Permalink
Fixed authentiation for SearchEsSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Sep 28, 2023
1 parent 9fd69d4 commit d20f0ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/AppSearch/Request/SearchEsSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(string $engineName, string $authorization, EsSearchP
{
$this->method = 'POST';
$engine_name = urlencode($engineName);
$this->headers['Authorization'] = $authorization;
$this->setAuthorization($authorization);
$this->path = "/api/as/v1/engines/$engine_name/elasticsearch/_search";
$this->headers['Content-Type'] = 'application/json';
$this->body = $es_search_params;
Expand Down
3 changes: 1 addition & 2 deletions tests/Integration/AppSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ public function testSearchEsSearch(string $id)
];

$result = $this->appSearch->searchEsSearch(
(new Request\SearchEsSearch('test', $searchParams))
->setAuthorization(getenv('ELASTICSEARCH_API_KEY'))
new Request\SearchEsSearch('test', getenv('ELASTICSEARCH_API_KEY'), $searchParams)
);

$this->assertCount(1, $result['hits']['hits']);
Expand Down

0 comments on commit d20f0ac

Please sign in to comment.