diff --git a/http/src/upgrade.rs b/http/src/upgrade.rs index 9a0239c55c..91e9deae2f 100644 --- a/http/src/upgrade.rs +++ b/http/src/upgrade.rs @@ -45,21 +45,11 @@ pub struct Upgrade { impl Upgrade { /// see [`request_headers`] - #[deprecated = "use Upgrade::request_headers"] + #[deprecated = "directly access the request_headers field"] pub fn headers(&self) -> &Headers { &self.request_headers } - /// read-only access to the request headers - pub fn request_headers(&self) -> &Headers { - &self.request_headers - } - - /// mutable access to headers - pub fn request_headers_mut(&mut self) -> &mut Headers { - &mut self.request_headers - } - /// the http request path up to but excluding any query component pub fn path(&self) -> &str { match self.path.split_once('?') { @@ -70,10 +60,10 @@ impl Upgrade { /// retrieves the query component of the path pub fn querystring(&self) -> &str { - match self.path.split_once('?') { - Some((_, query)) => query, - None => "", - } + self.path + .split_once('?') + .map(|(_, query)| query) + .unwrap_or_default() } /// the http method