From 563a368ab09b3b0c317ebbc0dca74c510463f124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 7 Jul 2020 21:06:11 +0800 Subject: [PATCH] Fixed UrlBuilder on its string output. --- mia_core/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mia_core/utils.py b/mia_core/utils.py index 0c5387d..20e4e0f 100644 --- a/mia_core/utils.py +++ b/mia_core/utils.py @@ -92,7 +92,10 @@ class UrlBuilder: return self.del_param(name).add_param(name, value) def __str__(self): - return self.base_path + "&".join([str(x) for x in self.params]) + if len(self.params) == 0: + return self.base_path + return self.base_path + "?" + "&".join([ + str(x) for x in self.params]) class Param: """A query parameter.