src/Leevel/Http/Leevel2Psr.php
public function createResponse(Response $leevelResponse): ResponseInterface
    {
        $stream = new DiactorosStream('php://temp', 'wb+');
        $stream->write($leevelResponse->getContent());

        $headers = $leevelResponse->headers->all();

        if (!isset($headers['Set-Cookie']) &&
            !isset($headers['set-sookie']) &&
            $cookies = $leevelResponse->getCookies()) {
            foreach ($cookies as $item) {
                $headers['Set-Cookie'][] = Cookie::format($item);
            }
        }

        $response = new DiactorosResponse(
            $stream,
            $leevelResponse->getStatusCode(),
            $headers
        );

        $protocolVersion = $leevelResponse->getProtocolVersion();

        if ('1.1' !== $protocolVersion) {
            $response = $response->withProtocolVersion($protocolVersion);
        }

        return $response;
    }
public function createResponse(Response $leevelResponse): ResponseInterface
    {
        $stream = new DiactorosStream('php://temp', 'wb+');
        $stream->write($leevelResponse->getContent());

        $headers = $leevelResponse->headers->all();

        if (!isset($headers['Set-Cookie']) &&
            !isset($headers['set-sookie']) &&
            $cookies = $leevelResponse->getCookies()) {
            foreach ($cookies as $item) {
                $headers['Set-Cookie'][] = Cookie::format($item);
            }
        }

        $response = new DiactorosResponse(
            $stream,
            $leevelResponse->getStatusCode(),
            $headers
        );

        $protocolVersion = $leevelResponse->getProtocolVersion();

        if ('1.1' !== $protocolVersion) {
            $response = $response->withProtocolVersion($protocolVersion);
        }

        return $response;
    }
从 Leevel 响应对象创建 Psr 响应对象

@param \Leevel\Http\IResponse $leevelResponse

@return \Psr\Http\Message\ResponseInterface