Skip to content

Commit

Permalink
Merge pull request #49 from nox7/fix-json-post-data-ignored
Browse files Browse the repository at this point in the history
Only attempt PHP $_POST processing if data is available
  • Loading branch information
nox7 authored Feb 27, 2023
2 parents b076abd + 081619a commit fd12676
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function processRequestBody(): void
// by PHP.
$requestMethodLowered = strtolower($_SERVER['REQUEST_METHOD']);
$requestPayload = new RequestPayload();
if ($requestMethodLowered === "post") {
if ($requestMethodLowered === "post" && (!empty($_POST) || !empty($_FILES))) {
// Handle creating the RequestPayload object for the POST fields and then check if the _FILES
// fields are not empty
foreach ($_POST as $key => $value) {
Expand Down

0 comments on commit fd12676

Please sign in to comment.