Skip to content
Myr

Test stripping standard auth.

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

authored by Cory Benfield · committed by Cory Benfield · parent 4f6dca4 · Browse files · 1 file+17 added−0 removed
This commit

State

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

Diff stats

1 file+17 added−0 removed

  • other:+17 added−0 removed

1 file+17 added−0 removed

modified:test_requests.py+17 added
15 unmodified lines
16from requests.compat import (17 Morsel, cookielib, getproxies, str, urljoin, urlparse)18from requests.cookies import cookiejar_from_dict, morsel_to_cookie19from requests.exceptions import InvalidURL, MissingSchema20from requests.models import PreparedRequest, Response21from requests.structures import CaseInsensitiveDict2223try:24 import StringIO
840 unmodified lines
865 req = requests.Request('GET', test_url)866 preq = req.prepare()867 assert test_url == preq.url868869 def test_auth_is_stripped_on_redirect_off_host(self):870 r = requests.get(871 httpbin('redirect-to'),872 params={'url': 'http://www.google.co.uk'},873 auth=('user', 'pass'),874 )875 assert r.history[0].request.headers['Authorization']876 assert not r.request.headers.get('Authorization', '')877878 def test_auth_is_retained_for_redirect_on_host(self):879 r = requests.get(httpbin('redirect/1'), auth=('user', 'pass'))880 h1 = r.history[0].request.headers['Authorization']881 h2 = r.request.headers['Authorization']882883 assert h1 == h2884885886class TestContentEncodingDetection(unittest.TestCase):887888 def test_none(self):889 encodings = requests.utils.get_encodings_from_content('')
319 unmodified lines