Skip to content
Myr

prefer the url's scheme over the kwarg

Before adoption: this commit came in with the history the project adopted, so no landing records it.

tabs -> spaces add test add changelog

authored by David Lord · committed by David Lord · parent 241673f · Browse files · 3 files+17 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+17 added−4 removed

  • tests:+8 added−0 removed
  • other:+9 added−4 removed

3 files+17 added−4 removed

modified:flask/testing.py+6 added-4 removed
38 unmodified lines
3940 if subdomain:41 http_host = '{0}.{1}'.format(subdomain, http_host)4243 url = url_parse(path)43 if url_scheme is None:45 url_scheme = url.scheme or app.config['PREFERRED_URL_SCHEME']44 url_scheme = app.config['PREFERRED_URL_SCHEME']4547 base_url = '{0}://{1}/{2}'.format(48 url_scheme, url.netloc or http_host, app_root.lstrip('/')46 url = url_parse(path)47 base_url = '{scheme}://{netloc}/{path}'.format(48 scheme=url.scheme or url_scheme,49 netloc=url.netloc or http_host,50 path=app_root.lstrip('/')51 )52 path = url.path5354 if url.query:
145 unmodified lines
modified:tests/test_testing.py+8 added
102 unmodified lines
103 rv = client.get('/', url_scheme='https')104 assert rv.data == b'https://localhost/'105106107def test_path_is_url(app):108 eb = make_test_environ_builder(app, 'https://example.com/')109 assert eb.url_scheme == 'https'110 assert eb.host == 'example.com'111 assert eb.script_root == ''112 assert eb.path == '/'113114115def test_blueprint_with_subdomain(app, client):116 app.config['SERVER_NAME'] = 'example.com:1234'117 app.config['APPLICATION_ROOT'] = '/foo'118
219 unmodified lines
modified:CHANGES+3 added
102 unmodified lines
103 ``test_client.open``. (`#2412`_)104- The ``flask`` command and ``app.run`` will load environment variables using105 from ``.env`` and ``.flaskenv`` files if python-dotenv is installed.106 (`#2416`_)107- When passing a full URL to the test client, use the scheme in the URL instead108 of the ``PREFERRED_URL_SCHEME``. (`#2436`_)109110.. _#1421: https://github.com/pallets/flask/issues/1421111.. _#1489: https://github.com/pallets/flask/pull/1489112.. _#1621: https://github.com/pallets/flask/pull/1621
22 unmodified lines
135.. _#2385: https://github.com/pallets/flask/issues/2385136.. _#2412: https://github.com/pallets/flask/pull/2412137.. _#2414: https://github.com/pallets/flask/pull/2414138.. _#2416: https://github.com/pallets/flask/pull/2416139.. _#2436: https://github.com/pallets/flask/pull/2436140141Version 0.12.2142--------------143
617 unmodified lines