src/Message/Request.php
protected function setUri(UriInterface $uri, $preserveHost = false)
    {
        if (! $preserveHost && $uri->getHost() !== '') {
            $key = $this->headerKey('Host');
            $this->headers[$key] = [$uri->getHost()];
        }

        $this->uri = $uri;
    }
protected function setUri(UriInterface $uri, $preserveHost = false)
    {
        if (! $preserveHost && $uri->getHost() !== '') {
            $key = $this->headerKey('Host');
            $this->headers[$key] = [$uri->getHost()];
        }

        $this->uri = $uri;
    }
Sets the request URI

@param UriInterface $uri
@param bool $preserveHost