src/Leevel/Protocol/HttpServer.php
protected function normalizeRequest(SwooleHttpRequest $swooleRequest): IRequest
    {
        $request = new Request();

        $datas = [
            'header' => 'headers',
            'server' => 'server',
            'cookie' => 'cookies',
            'get'    => 'query',
            'files'  => 'files',
            'post'   => 'request',
        ];

        $servers = [];

        if ($swooleRequest->header) {
            $tmp = $tmpHeader = [];

            foreach ($swooleRequest->header as $key => $value) {
                $key = strtoupper(str_replace('-', '_', $key));
                $tmpHeader[$key] = $value;

                $key = 'HTTP_'.$key;
                $tmp[$key] = $value;
            }

            $servers = $tmp;
            $swooleRequest->header = $tmpHeader;
        }

        if ($swooleRequest->server) {
            $swooleRequest->server = array_change_key_case(
                $swooleRequest->server,
                CASE_UPPER
            );

            $servers = array_merge($servers, $swooleRequest->server);
            $swooleRequest->server = $servers;
        } else {
            $swooleRequest->server = $servers ?: null;
        }

        foreach ($datas as $key => $item) {
            if ($swooleRequest->{$key}) {
                $request->{$item}->replace($swooleRequest->{$key});
            }
        }

        return $request;
    }
protected function normalizeRequest(SwooleHttpRequest $swooleRequest): IRequest
    {
        $request = new Request();

        $datas = [
            'header' => 'headers',
            'server' => 'server',
            'cookie' => 'cookies',
            'get'    => 'query',
            'files'  => 'files',
            'post'   => 'request',
        ];

        $servers = [];

        if ($swooleRequest->header) {
            $tmp = $tmpHeader = [];

            foreach ($swooleRequest->header as $key => $value) {
                $key = strtoupper(str_replace('-', '_', $key));
                $tmpHeader[$key] = $value;

                $key = 'HTTP_'.$key;
                $tmp[$key] = $value;
            }

            $servers = $tmp;
            $swooleRequest->header = $tmpHeader;
        }

        if ($swooleRequest->server) {
            $swooleRequest->server = array_change_key_case(
                $swooleRequest->server,
                CASE_UPPER
            );

            $servers = array_merge($servers, $swooleRequest->server);
            $swooleRequest->server = $servers;
        } else {
            $swooleRequest->server = $servers ?: null;
        }

        foreach ($datas as $key => $item) {
            if ($swooleRequest->{$key}) {
                $request->{$item}->replace($swooleRequest->{$key});
            }
        }

        return $request;
    }
格式化 swoole 请求到 QueryPHP 请求

@param \Swoole\Http\Request $swooleRequest

@return \Leevel\Http\IRequest