From e8419fe31b35aeb4c1226494f18a7b87597f6ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 15 Sep 2020 18:36:28 +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 --- HttpServer/Events/OnRequest.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/HttpServer/Events/OnRequest.php b/HttpServer/Events/OnRequest.php index be0d4ad2..b42f5993 100644 --- a/HttpServer/Events/OnRequest.php +++ b/HttpServer/Events/OnRequest.php @@ -42,7 +42,7 @@ class OnRequest extends Callback register_shutdown_function(OnRequest::class . '::shutdown', $response); /** @var HRequest $sRequest */ - [$sRequest, $sResponse] = static::setContext($request, $response); + [$sRequest, $sResponse] = [HRequest::create($request), HResponse::create($response)]; if ($sRequest->is('favicon.ico')) { return $params = $sResponse->send($sRequest->isNotFound(), 200); } @@ -104,19 +104,4 @@ class OnRequest extends Callback return $sResponse->send($params, 200); } - - /** - * @param $request - * @param $response - * @return array - * @throws Exception - */ - public static function setContext($request, $response): array - { - $request = Context::setContext('request', HRequest::create($request)); - $response = Context::setContext('response', HResponse::create($response)); - return [$request, $response]; - } - - }