private function replaceHostHeader(UriInterface $uri)
    {
        $host = $uri->getHost();

        if (!empty($host)) {

            $port = $uri->getPort();
            if (!empty($port)) {
                $host .= ':' . $port;
            }

            //~ Ensure Host is the first header. See: http://tools.ietf.org/html/rfc7230#section-5.4
            $this->headersOriginal = ['Host' => [$host]] + $this->headersOriginal;
            $this->headers         = ['host' => [$host]] + $this->headers;
        }
    }