Skip to content

Commit 8b5ccca

Browse files
fruno-bulaxlpil
authored andcommitted
Handle base URLs without trailing slash
1 parent 04bcf1a commit 8b5ccca

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/lib.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,16 @@ fn make_request(
7676
let mut parts = base.into_parts();
7777
parts.path_and_query = Some(
7878
match parts.path_and_query {
79-
Some(path) => format!("{}{}", path, path_suffix).try_into(),
79+
Some(path_and_query) => {
80+
let mut path = path_and_query.path().to_owned();
81+
if !path.ends_with('/') {
82+
path.push('/');
83+
}
84+
path += path_suffix;
85+
86+
// Drop query parameters
87+
path.try_into()
88+
}
8089
None => path_suffix.try_into(),
8190
}
8291
.expect("api_uri path"),

0 commit comments

Comments
 (0)