From 3b9c69492877e585748b376fc541335d24773886 Mon Sep 17 00:00:00 2001 From: Timo Caktu Date: Wed, 2 Aug 2023 20:09:39 +0200 Subject: [PATCH] implemented function which returns full uir --- actix-web/src/request.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/actix-web/src/request.rs b/actix-web/src/request.rs index ece36a388..f49f5e1f4 100644 --- a/actix-web/src/request.rs +++ b/actix-web/src/request.rs @@ -91,6 +91,18 @@ impl HttpRequest { &self.head().uri } + /// Request's full uri (scheme + host + origin). + #[inline] + pub fn full_uri(&self) -> Uri { + let uri: Uri = Uri::builder() + .scheme(self.connection_info().scheme()) + .authority(self.connection_info().host()) + .path_and_query(self.uri().to_string()) + .build() + .unwrap(); + uri + } + /// Read the Request method. #[inline] pub fn method(&self) -> &Method {