src/Web/Formatters/HtmlResponseFormatter.php
public function format($responseBuilder)
    {
        if (stripos($this->contentType, 'charset') === false) {
            $this->contentType .= '; charset=' . $responseBuilder->charset;
        }
        $responseBuilder->getHeaders()->set('Content-Type', $this->contentType);
        $body = $responseBuilder->getRawBody();
        if (!is_string($body) && !($body instanceof StreamInterface)) {
            $body = print_r($body, true);
        }
        return $body;
    }
public function format($responseBuilder)
    {
        if (stripos($this->contentType, 'charset') === false) {
            $this->contentType .= '; charset=' . $responseBuilder->charset;
        }
        $responseBuilder->getHeaders()->set('Content-Type', $this->contentType);
        $body = $responseBuilder->getRawBody();
        if (!is_string($body) && !($body instanceof StreamInterface)) {
            $body = print_r($body, true);
        }
        return $body;
    }
Formats the specified response.
@param ResponseBuilderInterface $responseBuilder the response to be formatted.
@return \Psr\Http\Message\StreamInterface|string