Skip to content

Commit 968e862

Browse files
authored
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>
1 parent 2ce2e12 commit 968e862

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

url/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,11 @@ impl Url {
444444
/// let url = base.join("//eve.com/b")?;
445445
/// assert_eq!(url.as_str(), "https://eve.com/b");
446446
///
447+
/// // Input as base url relative special URL
448+
/// let base = Url::parse("https://alice.com/a")?;
449+
/// let url = base.join("/v1/meta")?;
450+
/// assert_eq!(url.as_str(), "https://alice.com/v1/meta");
451+
///
447452
/// // Input as absolute URL
448453
/// let base = Url::parse("https://alice.com/a")?;
449454
/// let url = base.join("http://eve.com/b")?;

0 commit comments

Comments
 (0)