src/Http/ServerRequest.php
public function withRequestTarget($request_target)
    {
        $request_target = explode('?', (string)$request_target);

        $server_request = clone $this;
        $server_request->uri = $this->uri->withPath($request_target[0]);
        $server_request->uri = $server_request->uri->withQuery($request_target[1]);

        return $server_request;
    }
public function withRequestTarget($request_target)
    {
        $request_target = explode('?', (string)$request_target);

        $server_request = clone $this;
        $server_request->uri = $this->uri->withPath($request_target[0]);
        $server_request->uri = $server_request->uri->withQuery($request_target[1]);

        return $server_request;
    }
Return an instance with the specific request-target.
If the request needs a non-origin-form request-target — e.g., for
specifying an absolute-form, authority-form, or asterisk-form —
this method may be used to create an instance with the specified
request-target, verbatim.
This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that has the
changed request target.

@link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
request-target forms allowed in request messages)
@param string $request_target
@return RequestInterface
@throws InvalidArgumentException