Browse Source

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
pull/2430/head
Igor Kasianov 8 years ago
parent
commit
241673fd15
  1. 4
      flask/testing.py

4
flask/testing.py

@ -40,10 +40,10 @@ def make_test_environ_builder(
if subdomain: if subdomain:
http_host = '{0}.{1}'.format(subdomain, http_host) http_host = '{0}.{1}'.format(subdomain, http_host)
url = url_parse(path)
if url_scheme is None: 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( base_url = '{0}://{1}/{2}'.format(
url_scheme, url.netloc or http_host, app_root.lstrip('/') url_scheme, url.netloc or http_host, app_root.lstrip('/')
) )

Loading…
Cancel
Save