Skip to content

Commit 7d1f9ea

Browse files
committed
Normalise headers
1 parent 7763987 commit 7d1f9ea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Adapter/Swoole.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ private function configureBody(CoClient $client, mixed $body, array $headers): v
183183
return;
184184
}
185185

186+
$normalizedHeaders = array_change_key_case($headers, CASE_LOWER);
187+
186188
if (is_array($body)) {
187189
$hasFiles = false;
188190
$formData = [];
@@ -210,7 +212,7 @@ private function configureBody(CoClient $client, mixed $body, array $headers): v
210212
foreach ($formData as $key => $value) {
211213
$client->addData($value, $key);
212214
}
213-
} elseif (isset($headers['content-type']) && $headers['content-type'] === 'application/x-www-form-urlencoded') {
215+
} elseif (isset($normalizedHeaders['content-type']) && $normalizedHeaders['content-type'] === 'application/x-www-form-urlencoded') {
214216
$client->setData(http_build_query($body));
215217
} else {
216218
$client->setData($body);

0 commit comments

Comments
 (0)