mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-15 18:23:26 +03:00
Updated Request::isPostBack to return true if request-method could contain data in body.
This commit is contained in:
@@ -71,7 +71,7 @@ class InputHandler
|
||||
/* Parse post requests */
|
||||
$this->originalPost = $_POST;
|
||||
|
||||
if (\in_array($this->request->getMethod(), Request::$requestTypesPost, false) === true) {
|
||||
if ($this->request->isPostBack() === true) {
|
||||
|
||||
$contents = file_get_contents('php://input');
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class BaseCsrfVerifier implements IMiddleware
|
||||
*/
|
||||
public function handle(Request $request): void
|
||||
{
|
||||
if ($this->skip($request) === false && \in_array($request->getMethod(), Request::$requestTypesPost, true) === true) {
|
||||
if ($this->skip($request) === false && $request->isPostBack() === true) {
|
||||
|
||||
$token = $request->getInputHandler()->value(
|
||||
static::POST_KEY,
|
||||
|
||||
@@ -363,13 +363,13 @@ class Request
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when request-type is post.
|
||||
* Returns true when request-method is type that could contain data in the page body.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPostBack(): bool
|
||||
{
|
||||
return ($this->getMethod() === static::REQUEST_TYPE_POST);
|
||||
return \in_array($this->getMethod(), static::$requestTypesPost, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user