build: do not append params if they don't exist.
This commit is contained in:
parent
c4f69d6f6c
commit
16a062c105
1 changed files with 7 additions and 4 deletions
|
@ -950,12 +950,15 @@ pub fn build_url(base: &Url, path: &str, params: Vec<(&str, String)>) -> Result<
|
|||
let mut url = base.join(path)?;
|
||||
|
||||
{
|
||||
// If len was 0 `?` would be appended without being needed.
|
||||
if params.len() >= 1 {
|
||||
let mut query = url.query_pairs_mut();
|
||||
query.clear();
|
||||
for (k, v) in params {
|
||||
query.append_pair(k, &v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(url)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue