From 22bef30f815408f99893b996042f6cc9d9f2df57 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Fri, 24 Feb 2017 12:43:26 -0500 Subject: [PATCH] Fix prefix handling for relative urls Basically we just remove the trailing prefix / and leading path / and then join with /. --- gabbi/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gabbi/utils.py b/gabbi/utils.py index 39e0331..ef1462c 100644 --- a/gabbi/utils.py +++ b/gabbi/utils.py @@ -63,7 +63,9 @@ def create_url(base_url, host, port=None, prefix='', ssl=False): # this covers most common cases and will be okay until someone # reports a bug. if prefix and not path.startswith(prefix): - path = '%s%s' % (prefix, path) + prefix = prefix.rstrip('/') + path = path.lstrip('/') + path = '%s/%s' % (prefix, path) return urlparse.urlunsplit((scheme, netloc, path, query_string, ''))