From ea7ed8839946824c3f734645648000e0c14f64bb Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Wed, 1 Jul 2020 00:53:10 -0700 Subject: [PATCH] Request: rename path field to URL. (#104) * Request: rename path field to URL. This more accurately reflects its use. --- src/request.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/request.rs b/src/request.rs index b588017..715fb36 100644 --- a/src/request.rs +++ b/src/request.rs @@ -39,7 +39,7 @@ pub struct Request { // via agent pub(crate) method: String, - path: String, + url: String, // from request itself pub(crate) headers: Vec
, @@ -72,11 +72,11 @@ impl ::std::fmt::Debug for Request { } impl Request { - pub(crate) fn new(agent: &Agent, method: String, path: String) -> Request { + pub(crate) fn new(agent: &Agent, method: String, url: String) -> Request { Request { agent: Arc::clone(&agent.state), method, - path, + url, headers: agent.headers.clone(), redirects: 5, ..Default::default() @@ -512,7 +512,7 @@ impl Request { /// assert_eq!(req.get_url(), "https://cool.server/innit"); /// ``` pub fn get_url(&self) -> &str { - &self.path + &self.url } /// Normalizes and returns the host that will be used for this request. @@ -558,7 +558,7 @@ impl Request { .map(|u| unit::combine_query(&u, &self.query, true)) } - /// The normalized path of this request. + /// The normalized url of this request. /// /// Example: /// ``` @@ -572,7 +572,7 @@ impl Request { fn to_url(&self) -> Result { URL_BASE - .join(&self.path) + .join(&self.url) .map_err(|e| Error::BadUrl(format!("{}", e))) }