From ea14572910311f97e0e43e7c34c61d8b7c263eef Mon Sep 17 00:00:00 2001 From: shiyifei Date: Thu, 26 Dec 2019 15:58:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E8=AF=B7=E6=B1=82=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=90=88=E6=B3=95=E6=80=A7=E6=97=B6=EF=BC=8C=E4=BC=A0?= =?UTF-8?q?=E5=85=A5=E5=BD=93=E5=89=8D=E8=AF=B7=E6=B1=82=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Middleware/ValidatorMiddleware.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Middleware/ValidatorMiddleware.php b/src/Middleware/ValidatorMiddleware.php index cbab82f..013246b 100644 --- a/src/Middleware/ValidatorMiddleware.php +++ b/src/Middleware/ValidatorMiddleware.php @@ -40,6 +40,8 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface return $handler->handle($request); } + $requestMethod = $request->getMethod(); + // Controller and method $handlerId = $route->getHandler(); [$className, $method] = explode('@', $handlerId); @@ -64,8 +66,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface $validator = BeanFactory::getBean('validator'); /* @var Request $request */ - [$parsedBody, $query] = $validator->validateRequest($parsedBody, $validates, $query); - + [$parsedBody, $query] = $validator->validateRequest($parsedBody, $validates, $query, $requestMethod); if ($notParsedBody) { $parsedBody = $data; }