Skip to content
Myr

Added test for redirect with wrong gzipped header.

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

authored by schlamar · committed by schlamar · parent 5e860c0 · Browse files · 1 file+20 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+20 added−0 removed

  • other:+20 added−0 removed

1 file+20 added−0 removed

modified:test_requests.py+20 added
934 unmodified lines
935 pass936 r3 = next(rg)937 assert not r3.is_redirect938939 def _patch_adapter_gzipped_redirect(self, session, url):940 adapter = session.get_adapter(url=url)941 org_build_response = adapter.build_response942 self._patched_response = False943944 def build_response(*args, **kwargs):945 resp = org_build_response(*args, **kwargs)946 if not self._patched_response:947 resp.raw.headers['content-encoding'] = 'gzip'948 self._patched_response = True949 return resp950951 adapter.build_response = build_response952953 def test_redirect_with_wrong_gzipped_header(self):954 s = requests.Session()955 url = httpbin('redirect/1')956 self._patch_adapter_gzipped_redirect(s, url)957 s.get(url)958959960class TestContentEncodingDetection(unittest.TestCase):961962 def test_none(self):963 encodings = requests.utils.get_encodings_from_content('')
403 unmodified lines