Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ public function __construct(
?ClientInterface $httpClient = null,
?RequestFactoryInterface $requestFactory = null,
array $clientAgents = [],
?StreamFactoryInterface $streamFactory = null
?StreamFactoryInterface $streamFactory = null,
$headers = []
Copy link
Preview

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a type declaration (e.g. array) for the $headers parameter in the constructor to maintain consistency across the client API.

Copilot uses AI. Check for mistakes.

) {
$this->http = new MeilisearchClientAdapter($url, $apiKey, $httpClient, $requestFactory, $clientAgents, $streamFactory);
$this->http = new MeilisearchClientAdapter($url, $apiKey, $httpClient, $requestFactory, $clientAgents, $streamFactory, $headers);
$this->index = new Indexes($this->http);
$this->health = new Health($this->http);
$this->version = new Version($this->http);
Expand Down
4 changes: 3 additions & 1 deletion src/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public function __construct(
?ClientInterface $httpClient = null,
?RequestFactoryInterface $reqFactory = null,
array $clientAgents = [],
?StreamFactoryInterface $streamFactory = null
?StreamFactoryInterface $streamFactory = null,
$headers = []
Copy link
Preview

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a type declaration (e.g. array) for the $headers parameter to improve API consistency and type safety.

Copilot uses AI. Check for mistakes.

) {
$this->baseUrl = $url;
$this->http = $httpClient ?? Psr18ClientDiscovery::find();
Expand All @@ -53,6 +54,7 @@ public function __construct(
if (null !== $apiKey && '' !== $apiKey) {
$this->headers['Authorization'] = \sprintf('Bearer %s', $apiKey);
}
$this->headers = array_merge($this->headers, $headers);
$this->json = new Json();
}

Expand Down
Loading