Kaydet (Commit) 3566e7c2 authored tarafından Joffrey F's avatar Joffrey F Kaydeden (comit) GitHub

Merge pull request #1255 from docker/base_url_trailing_slash

Remove trailing slashes in result of utils.parse_host
...@@ -453,8 +453,8 @@ def parse_host(addr, is_win32=False, tls=False): ...@@ -453,8 +453,8 @@ def parse_host(addr, is_win32=False, tls=False):
"Bind address needs a port: {0}".format(addr)) "Bind address needs a port: {0}".format(addr))
if proto == "http+unix" or proto == 'npipe': if proto == "http+unix" or proto == 'npipe':
return "{0}://{1}".format(proto, host) return "{0}://{1}".format(proto, host).rstrip('/')
return "{0}://{1}:{2}{3}".format(proto, host, port, path) return "{0}://{1}:{2}{3}".format(proto, host, port, path).rstrip('/')
def parse_devices(devices): def parse_devices(devices):
......
...@@ -522,6 +522,11 @@ class ParseHostTest(base.BaseTestCase): ...@@ -522,6 +522,11 @@ class ParseHostTest(base.BaseTestCase):
expected_result = 'https://myhost.docker.net:3348' expected_result = 'https://myhost.docker.net:3348'
assert parse_host(host_value, tls=True) == expected_result assert parse_host(host_value, tls=True) == expected_result
def test_parse_host_trailing_slash(self):
host_value = 'tcp://myhost.docker.net:2376/'
expected_result = 'http://myhost.docker.net:2376'
assert parse_host(host_value) == expected_result
class ParseRepositoryTagTest(base.BaseTestCase): class ParseRepositoryTagTest(base.BaseTestCase):
sha = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' sha = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment