Skip to content

Commit 880dd56

Browse files
committed
:octocat:
1 parent 469710d commit 880dd56

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/Psr7/message_helpers.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,24 @@ function normalize_request_headers(array $headers):array{
2727
foreach($headers as $key => $val){
2828

2929
if(is_numeric($key)){
30-
$header = explode(':', $val, 2);
3130

32-
if(count($header) !== 2){
31+
if(is_string($val)){
32+
$header = explode(':', $val, 2);
33+
34+
if(count($header) !== 2){
35+
continue;
36+
}
37+
38+
$key = $header[0];
39+
$val = $header[1];
40+
}
41+
elseif(is_array($val)){
42+
$key = array_keys($val)[0];
43+
$val = array_values($val)[0];
44+
}
45+
else{
3346
continue;
3447
}
35-
36-
$key = $header[0];
37-
$val = $header[1];
3848
}
3949

4050
$key = ucfirst(strtolower(trim($key)));

0 commit comments

Comments
 (0)