This commit is contained in:
Martin Algesten
2018-07-02 12:33:47 +02:00
parent 1d541763c6
commit 1e536af904

View File

@@ -476,6 +476,20 @@ impl Request {
&self.method &self.method
} }
/// Get the url this request was created with.
///
/// This value is not normalized, it is exactly as set.
///
/// Example:
/// ```
/// let req = ureq::post("https://cool.server/innit")
/// .build();
/// assert_eq!(req.get_url(), "https://cool.server/innit");
/// ```
pub fn get_url(&self) -> &str {
&self.path
}
fn to_url(&self) -> Result<Url, Error> { fn to_url(&self) -> Result<Url, Error> {
URL_BASE URL_BASE
.join(&self.path) .join(&self.path)