From 1f8010a6ec278e6020f5479bd5ab526e2cbf2064 Mon Sep 17 00:00:00 2001 From: mokaddem Date: Thu, 17 Jun 2021 14:12:17 +0200 Subject: [PATCH] chg: [application] Added bodyParserMiddleware to parse JSON bodies --- src/Application.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Application.php b/src/Application.php index 8eb1704..2da0df1 100644 --- a/src/Application.php +++ b/src/Application.php @@ -21,6 +21,7 @@ use Cake\Core\Exception\MissingPluginException; use Cake\Error\Middleware\ErrorHandlerMiddleware; use Cake\Http\BaseApplication; use Cake\Http\MiddlewareQueue; +use Cake\Http\Middleware\BodyParserMiddleware; use Cake\Routing\Middleware\AssetMiddleware; use Cake\Routing\Middleware\RoutingMiddleware; use Authentication\AuthenticationService; @@ -28,7 +29,6 @@ use Authentication\AuthenticationServiceInterface; use Authentication\AuthenticationServiceProviderInterface; use Authentication\Middleware\AuthenticationMiddleware; use Psr\Http\Message\ServerRequestInterface; - /** * Application setup class. * @@ -87,7 +87,8 @@ class Application extends BaseApplication implements AuthenticationServiceProvid // using it's second constructor argument: // `new RoutingMiddleware($this, '_cake_routes_')` ->add(new RoutingMiddleware($this)) - ->add(new AuthenticationMiddleware($this)); + ->add(new AuthenticationMiddleware($this)) + ->add(new BodyParserMiddleware()); return $middlewareQueue; }