From a22de4ea3a3d1dd91fa7783146fc6fb5b0165ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 16 Apr 2023 02:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Constrict/Uri.php | 2 +- src/Server.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Constrict/Uri.php b/src/Constrict/Uri.php index 381c31d..25ee1bd 100644 --- a/src/Constrict/Uri.php +++ b/src/Constrict/Uri.php @@ -395,7 +395,7 @@ class Uri implements UriInterface public static function parse(\Swoole\Http\Request $request): UriInterface { $uri = new static(); - $uri->queryString = $request->server['query_string']; + $uri->queryString = $request->server['query_string'] ?? ''; $uri->path = $request->server['path_info']; $uri->port = $request->server['server_port']; if (isset($request->server['https']) && $request->server['https'] !== 'off') { diff --git a/src/Server.php b/src/Server.php index f543ec9..0cdc56d 100644 --- a/src/Server.php +++ b/src/Server.php @@ -117,10 +117,10 @@ class Server implements OnRequestInterface ->withUri(Uri::parse($request)) ->withProtocolVersion($request->server['server_protocol']) ->withCookieParams($request->cookie ?? []) - ->withQueryParams($request->get) - ->withUploadedFiles($request->files) + ->withQueryParams($request->get ?? []) + ->withUploadedFiles($request->files ?? []) ->withMethod($request->getMethod()) - ->withParsedBody($request->post); + ->withParsedBody($request->post ?? []); /** @var ConstrictRequest $PsrRequest */ return Context::set(RequestInterface::class, $serverRequest);