From 05e8c9862148014b2bb8e023c8e376947dd4c9a7 Mon Sep 17 00:00:00 2001 From: Jan Tvrdik Date: Sun, 9 Aug 2015 14:17:22 +0200 Subject: [PATCH] Request: added withUrl() --- src/Http/IRequest.php | 7 +++++++ src/Http/Request.php | 13 +++++++++++++ 2 files changed, 20 insertions(+) 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