From 152600f9859737f16d624be380f1134890c771e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 24 Sep 2021 17:56:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-handler/Abstracts/Middleware.php | 4 ---- http-handler/CoreMiddleware.php | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/http-handler/Abstracts/Middleware.php b/http-handler/Abstracts/Middleware.php index 0ef5e1d5..5e681292 100644 --- a/http-handler/Abstracts/Middleware.php +++ b/http-handler/Abstracts/Middleware.php @@ -13,8 +13,4 @@ use Server\Constrict\ResponseInterface; abstract class Middleware implements MiddlewareInterface { - - #[Inject(ResponseInterface::class)] - public ResponseInterface $response; - } diff --git a/http-handler/CoreMiddleware.php b/http-handler/CoreMiddleware.php index 17fddc8e..b0dd99dd 100644 --- a/http-handler/CoreMiddleware.php +++ b/http-handler/CoreMiddleware.php @@ -20,11 +20,11 @@ class CoreMiddleware extends Middleware */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { - $this->response->withAccessControlAllowOrigin('*') + $response = response()->withAccessControlAllowOrigin('*') ->withAccessControlRequestMethod($request->getAccessControlRequestMethod()) ->withAccessControlAllowHeaders($request->getAccessControlAllowHeaders()); - var_dump($this->response); + var_dump($response); return $handler->handle($request); }