Skip to content

Commit

Permalink
Merge pull request #63 from joanhey/request-clean
Browse files Browse the repository at this point in the history
Request clean
  • Loading branch information
joanhey authored Jan 5, 2024
2 parents 6662f1d + 441a434 commit 4171d02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public static function decode(string $recv_buffer, TcpConnection $connection): v
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_SERVER['CONTENT_TYPE']) {
match ($_SERVER['CONTENT_TYPE']) {
'multipart/form-data' => static::parseMultipart($http_body, $http_post_boundary),
'application/json' => $_POST = \json_decode($http_body, true) ?? [],
'application/json' => $_POST = \json_decode($http_body, true, flags: \JSON_THROW_ON_ERROR) ?? [],
'application/x-www-form-urlencoded' => \parse_str($http_body, $_POST),
default => ''
};
Expand All @@ -415,10 +415,10 @@ public static function decode(string $recv_buffer, TcpConnection $connection): v
$data = [];
match ($_SERVER['CONTENT_TYPE']) {
'application/x-www-form-urlencoded' => \parse_str($http_body, $data),
'application/json' => $data = \json_decode($http_body, true) ?? [],
'application/json' => $data = \json_decode($http_body, true, flags: \JSON_THROW_ON_ERROR) ?? [],
default => ''
};
$_REQUEST = [...$_REQUEST, ...$data];
$_REQUEST = $data;
}

// HTTP_RAW_REQUEST_DATA HTTP_RAW_POST_DATA
Expand Down

0 comments on commit 4171d02

Please sign in to comment.