瀏覽代碼

docs: base url relative join (#1013)

* docs: base url relative join

Signed-off-by: tison <wander4096@gmail.com>

* alongside fix format

Signed-off-by: tison <wander4096@gmail.com>

---------

Signed-off-by: tison <wander4096@gmail.com>
tison 1 年之前
父節點
當前提交
968e862516
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      url/src/lib.rs

+ 5 - 0
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")?;