src/Leevel/Protocol/HttpServer.php
protected function normalizeResponse(IResponse $response, SwooleHttpResponse $swooleResponse): SwooleHttpResponse
    {
        foreach ($response->getCookies() as $item) {
            call_user_func_array([$swooleResponse, 'cookie'], $item);
        }

        if ($response instanceof RedirectResponse &&
            method_exists($swooleResponse, 'redirect')) {
            $swooleResponse->redirect($response->getTargetUrl());
        }

        foreach ($response->headers->all() as $key => $value) {
            $swooleResponse->header($key, $value);
        }

        $swooleResponse->status($response->getStatusCode());

        $swooleResponse->write($response->getContent() ?: ' ');

        return $swooleResponse;
    }
protected function normalizeResponse(IResponse $response, SwooleHttpResponse $swooleResponse): SwooleHttpResponse
    {
        foreach ($response->getCookies() as $item) {
            call_user_func_array([$swooleResponse, 'cookie'], $item);
        }

        if ($response instanceof RedirectResponse &&
            method_exists($swooleResponse, 'redirect')) {
            $swooleResponse->redirect($response->getTargetUrl());
        }

        foreach ($response->headers->all() as $key => $value) {
            $swooleResponse->header($key, $value);
        }

        $swooleResponse->status($response->getStatusCode());

        $swooleResponse->write($response->getContent() ?: ' ');

        return $swooleResponse;
    }
格式化 QueryPHP 响应到 swoole 响应.

@param \Leevel\Http\IResponse $response
@param \Swoole\Http\Response  $swooleResponse

@return \Swoole\Http\Response