From f828acf8fded2e37e55bd5fe4835cf1a21ee5032 Mon Sep 17 00:00:00 2001 From: tison Date: Sat, 28 Dec 2024 21:12:15 +0800 Subject: [PATCH 1/2] docs: base url relative join Signed-off-by: tison --- url/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/url/src/lib.rs b/url/src/lib.rs index e015acce..a59774ea 100644 --- a/url/src/lib.rs +++ b/url/src/lib.rs @@ -444,6 +444,11 @@ impl Url { /// let url = base.join("//eve.com/b")?; /// assert_eq!(url.as_str(), "https://eve.com/b"); /// + /// // Input as base url relative special URL + /// let base = Url::parse("https://alice.com/a")?; + /// let url = base.join("/v1/meta")?; + /// assert_eq!(url.as_str(), "https://alice.com/v1/meta"); + /// /// // Input as absolute URL /// let base = Url::parse("https://alice.com/a")?; /// let url = base.join("http://eve.com/b")?; From 68409771d0e382f6a236164ac5a8ea4b589541ae Mon Sep 17 00:00:00 2001 From: tison Date: Fri, 3 Jan 2025 11:50:34 +0800 Subject: [PATCH 2/2] alongside fix format Signed-off-by: tison --- url/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/url/src/lib.rs b/url/src/lib.rs index a59774ea..2fb26db4 100644 --- a/url/src/lib.rs +++ b/url/src/lib.rs @@ -453,7 +453,7 @@ impl Url { /// let base = Url::parse("https://alice.com/a")?; /// let url = base.join("http://eve.com/b")?; /// assert_eq!(url.as_str(), "http://eve.com/b"); // http instead of https - + /// /// # Ok(()) /// # } /// # run().unwrap();