From ab7c5090f14bb6eca60adbef8068a04f4817549f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 10 Sep 2021 11:58:01 +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-message/ServerRequest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/http-message/ServerRequest.php b/http-message/ServerRequest.php index 8e369a8f..e3af48b8 100644 --- a/http-message/ServerRequest.php +++ b/http-message/ServerRequest.php @@ -63,11 +63,12 @@ class ServerRequest extends Request implements ServerRequestInterface /** * @param \Swoole\Http\Request $request - * @return static + * @return static|ServerRequestInterface */ - public static function createServerRequest(\Swoole\Http\Request $request): static + public static function createServerRequest(\Swoole\Http\Request $request): static|ServerRequestInterface { - return (new static())->withServerParams($request->server) + return (new static())->parseRequestHeaders($request) + ->withServerParams($request->server) ->withServerTarget($request) ->withCookieParams($request->cookie) ->withUri(Uri::parseUri($request)) @@ -75,7 +76,6 @@ class ServerRequest extends Request implements ServerRequestInterface ->withQueryParams($request->get ?? []) ->withUploadedFiles($request->files ?? []) ->withMethod($request->getMethod()) - ->parseRequestHeaders($request) ->withParsedBody(function (StreamInterface $stream, ?array $posts) { try { $content = $stream->getContents();