Skip to content

Commit 8b899cb

Browse files
committed
change headers to lowercase to make headers case-insensitive
1 parent 34aba14 commit 8b899cb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Qiniu/Http/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static function sendRequest($request)
8383
CURLOPT_HEADER => true,
8484
CURLOPT_NOBODY => false,
8585
CURLOPT_CUSTOMREQUEST => $request->method,
86-
CURLOPT_URL => $request->url
86+
CURLOPT_URL => $request->url,
8787
);
8888

8989
// Handle open_basedir & safe mode
@@ -129,7 +129,7 @@ private static function parseHeaders($raw)
129129
$headerLine = trim($line);
130130
$kv = explode(':', $headerLine);
131131
if (count($kv) > 1) {
132-
$headers[$kv[0]] = trim($kv[1]);
132+
$headers[strtolower($kv[0])] = trim($kv[1]);
133133
}
134134
}
135135
return $headers;

src/Qiniu/Http/Response.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function json()
130130

131131
private static function bodyJson($body)
132132
{
133-
return \Qiniu\json_decode((string)$body, true, 512);
133+
return \Qiniu\json_decode((string) $body, true, 512);
134134
}
135135

136136
public function xVia()
@@ -170,7 +170,7 @@ public function needRetry()
170170

171171
private static function isJson($headers)
172172
{
173-
return array_key_exists('Content-Type', $headers) &&
174-
strpos($headers['Content-Type'], 'application/json') === 0;
173+
return array_key_exists('content-type', $headers) &&
174+
strpos($headers['content-type'], 'application/json') === 0;
175175
}
176176
}

0 commit comments

Comments
 (0)