diff --git a/src/Http/IRequest.php b/src/Http/IRequest.php index 8398e0d0..c78c932a 100644 --- a/src/Http/IRequest.php +++ b/src/Http/IRequest.php @@ -138,4 +138,11 @@ function getRemoteHost(); */ function getRawBody(); + + /** + * Returns new IRequest instance with modified URL. + * @return IRequest + */ + // public function withUrl(UrlScript $url); + } diff --git a/src/Http/Request.php b/src/Http/Request.php index df966589..c8bb875f 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -293,6 +293,19 @@ public function getRawBody() } + /** + * Returns new IRequest instance with modified URL. + * @return IRequest + */ + public function withUrl(UrlScript $url) + { + return new static( + $url, NULL, $this->post, $this->files, $this->cookies, $this->headers, $this->method, + $this->remoteAddress, $this->remoteHost, $this->rawBodyCallback + ); + } + + /** * Parse Accept-Language header and returns preferred language. * @param string[] supported languages