Skip to content

Commit 0373670

Browse files
committed
fix: patch up content_type issue
1 parent cc03c75 commit 0373670

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Request.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,17 @@ public static function input(bool $safeData = true)
8888
{
8989
$handler = fopen('php://input', 'r');
9090
$data = stream_get_contents($handler);
91-
$content_type = Headers::get('Content-Type') ?? '';
91+
$contentType = Headers::get('Content-Type') ?? '';
9292

93-
if ($content_type === 'application/x-www-form-urlencoded') {
93+
if ($contentType === 'application/x-www-form-urlencoded') {
9494
$d = $data;
9595
$data = [];
9696

9797
foreach (explode('&', $d) as $chunk) {
9898
$param = explode('=', $chunk);
9999
$data[$param[0]] = urldecode($param[1]);
100100
}
101-
} else if (strpos($content_type, 'application/json') !== 0 && strpos($content_type, 'multipart/form-data') !== 0) {
101+
} else if (strpos($contentType, 'application/json') !== 0 && strpos($contentType, 'multipart/form-data') !== 0) {
102102
$safeData = false;
103103
$data = [$data];
104104
} else {
@@ -358,7 +358,7 @@ public static function errors()
358358
*/
359359
public static function getContentType(): ?string
360360
{
361-
return Headers::get('CONTENT_TYPE');
361+
return Headers::get('Content-Type');
362362
}
363363

364364
/**

0 commit comments

Comments
 (0)