Skip to content

Commit 1711080

Browse files
committed
fix php headers
1 parent 02cc889 commit 1711080

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ private function normalize($options)
4848
{
4949
$normalized = [
5050
'headers' => [
51-
'X-Algolia-Application-Id' => $this->config->getAppId(),
52-
'X-Algolia-API-Key' => $this->config->getAlgoliaApiKey(),
53-
'User-Agent' => $this->config->getAlgoliaAgent() !== null
51+
'x-algolia-application-id' => $this->config->getAppId(),
52+
'x-algolia-api-key' => $this->config->getAlgoliaApiKey(),
53+
'User-Agent' =>
54+
$this->config->getAlgoliaAgent() !== null
5455
? $this->config->getAlgoliaAgent()
5556
: AlgoliaAgent::get(),
5657
'Content-Type' => 'application/json',
@@ -61,18 +62,22 @@ private function normalize($options)
6162
'writeTimeout' => $this->config->getWriteTimeout(),
6263
'connectTimeout' => $this->config->getConnectTimeout(),
6364
];
64-
6565
foreach ($options as $optionName => $value) {
6666
if (is_array($value) && $optionName === 'headers') {
6767
$headersToLowerCase = [];
68-
6968
foreach ($value as $key => $v) {
7069
$headersToLowerCase[mb_strtolower($key)] = $v;
7170
}
7271

73-
$normalized[$optionName] = $headersToLowerCase;
72+
$normalized[$optionName] = array_merge(
73+
$normalized[$optionName],
74+
$headersToLowerCase
75+
);
7476
} else {
75-
$normalized[$optionName] = $value;
77+
$normalized[$optionName] = array_merge(
78+
$normalized[$optionName],
79+
$value
80+
);
7681
}
7782
}
7883

0 commit comments

Comments
 (0)