From 16a062c10537b246ac816ac133e447730d05a781 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Tue, 26 Jun 2018 14:46:35 +0300 Subject: [PATCH] build: do not append params if they don't exist. --- fractal-matrix-api/src/util.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fractal-matrix-api/src/util.rs b/fractal-matrix-api/src/util.rs index d6bd8838..e8ecd6d6 100644 --- a/fractal-matrix-api/src/util.rs +++ b/fractal-matrix-api/src/util.rs @@ -950,10 +950,13 @@ pub fn build_url(base: &Url, path: &str, params: Vec<(&str, String)>) -> Result< let mut url = base.join(path)?; { - let mut query = url.query_pairs_mut(); - query.clear(); - for (k, v) in params { - query.append_pair(k, &v); + // 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); + } } }