diff --git a/mopidy/utils/http.py b/mopidy/utils/http.py index f0c658e7..096a37a0 100644 --- a/mopidy/utils/http.py +++ b/mopidy/utils/http.py @@ -25,7 +25,7 @@ def format_proxy(proxy_config): if port < 0: port = 80 - return template.format(scheme=proxy_config.get('scheme', 'http'), + return template.format(scheme=proxy_config.get('scheme') or 'http', username=proxy_config.get('username'), password=proxy_config.get('password'), hostname=proxy_config['hostname'], port=port) diff --git a/tests/utils/test_http.py b/tests/utils/test_http.py index cf97e57c..dee09c3c 100644 --- a/tests/utils/test_http.py +++ b/tests/utils/test_http.py @@ -10,6 +10,7 @@ from mopidy.utils import http @pytest.mark.parametrize("config,expected", [ ({}, None), ({'hostname': 'proxy.lan'}, 'http://proxy.lan:80'), + ({'scheme': None, 'hostname': 'proxy.lan'}, 'http://proxy.lan:80'), ({'scheme': 'https', 'hostname': 'proxy.lan'}, 'https://proxy.lan:80'), ({'username': 'user', 'hostname': 'proxy.lan'}, 'http://proxy.lan:80'), ({'password': 'pass', 'hostname': 'proxy.lan'}, 'http://proxy.lan:80'),