From 241673fd153bad011c3fbbb41580450f39874cad Mon Sep 17 00:00:00 2001 From: Igor Kasianov Date: Thu, 27 Jul 2017 14:44:23 +0300 Subject: [PATCH] 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 --- flask/testing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flask/testing.py b/flask/testing.py index d5109ce1..e0b7bcf0 100644 --- a/flask/testing.py +++ b/flask/testing.py @@ -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('/') )