make_test_environ_builder: use url_scheme from path if provided

When providing https url in path ("https://example.com/")
we hope that we will get https scheme in environment
This commit is contained in:
Igor Kasianov 2017-07-27 14:44:23 +03:00
parent 851eaa4db7
commit 241673fd15

View file

@ -40,10 +40,10 @@ def make_test_environ_builder(
if subdomain:
http_host = '{0}.{1}'.format(subdomain, http_host)
url = url_parse(path)
if url_scheme is None:
url_scheme = app.config['PREFERRED_URL_SCHEME']
url_scheme = url.scheme or app.config['PREFERRED_URL_SCHEME']
url = url_parse(path)
base_url = '{0}://{1}/{2}'.format(
url_scheme, url.netloc or http_host, app_root.lstrip('/')
)