Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Commit

Permalink
bugfix: Multipart can contain boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Castelnuovo committed Apr 30, 2021
1 parent a845186 commit ab42b96
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/Helpers/RequestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,23 @@ public function isJSON(): bool

public function isForm(): bool
{
$allowedTypes = [
'multipart/form-data',
'application/x-www-form-urlencoded'
];

return in_array(
needle: $this->getHeader('Content-Type'),
haystack: $allowedTypes,
strict: true
);
$contentType = $this->getHeader('Content-Type');

if (str_contains(
haystack: $contentType,
needle: 'multipart/form-data'
)) {
return true;
}

if (str_contains(
haystack: $contentType,
needle: 'application/x-www-form-urlencoded'
)) {
return true;
}

return false;
}

/**
Expand Down

0 comments on commit ab42b96

Please sign in to comment.