Merge pull request #5391 from wenottingham/really-we-would-remove-the-drummer-before-slash

Don't error on a trailing slash, just fix it up

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-12-16 17:19:34 +00:00 committed by GitHub
commit c43a59e475
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,9 +74,11 @@ class Connection(object):
raise ConnectionException(message="Unknown request method: {0}".format(method))
use_endpoint = relative_endpoint
if self.server.endswith('/') and use_endpoint.startswith('/'):
raise RuntimeError('AWX URL given with trailing slash, remove slash.')
url = '{0.server}{1}'.format(self, use_endpoint)
if self.server.endswith('/'):
self.server = self.server[:-1]
if use_endpoint.startswith('/'):
use_endpoint = use_endpoint[1:]
url = '/'.join([self.server, use_endpoint])
kwargs = dict(verify=self.verify, params=query_parameters, json=json, data=data,
hooks=dict(response=log_elapsed))