Skip to content

Commit 674346e

Browse files
committed
Refactor headers normalization. Thanks for @shoman4eg
1 parent dc511ea commit 674346e

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"require": {
1515
"php": "^7.4 || ^8.0",
1616
"ext-json": "*",
17+
"ext-mbstring": "*",
1718
"psr/http-client": "^1.0",
1819
"psr/http-message": "^1.0",
1920
"psr/http-server-handler": "^1.0"

src/Message/ServerRequest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,7 @@ public function withoutAttribute($name)
404404

405405
private function normalizeHeaderName(string $name): string
406406
{
407-
return preg_replace_callback('/(^|-)[a-z]/u', function (array $matches) {
408-
return strtoupper($matches[0]);
409-
}, strtolower($name));
407+
return mb_convert_case($name, MB_CASE_TITLE);
410408
}
411409

412410
private function parseBody(string $contentType, string $contents, $allowRecursion = false)

0 commit comments

Comments
 (0)