summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_requests.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/test_requests.py b/tests/test_requests.py
index 5b6a7f58..6a0727b8 100644
--- a/tests/test_requests.py
+++ b/tests/test_requests.py
@@ -17,10 +17,15 @@ import pytest
from requests.adapters import HTTPAdapter
from requests.auth import HTTPDigestAuth, _basic_auth_str
from requests.compat import (
- Morsel, cookielib, getproxies, str, urlparse,
- builtin_str)
-from requests.cookies import (
- cookiejar_from_dict, morsel_to_cookie)
+ Morsel,
+ cookielib,
+ getproxies,
+ str,
+ urlparse,
+ builtin_str,
+ SKIP_HEADER,
+)
+from requests.cookies import cookiejar_from_dict, morsel_to_cookie
from requests.exceptions import (
ConnectionError, ConnectTimeout, InvalidSchema, InvalidURL,
MissingSchema, ReadTimeout, Timeout, RetryError, TooManyRedirects,
@@ -438,10 +443,13 @@ class TestRequests:
def test_headers_on_session_with_None_are_not_sent(self, httpbin):
"""Do not send headers in Session.headers with None values."""
ses = requests.Session()
- ses.headers['Accept-Encoding'] = None
- req = requests.Request('GET', httpbin('get'))
+ ses.headers["Accept-Encoding"] = None
+ req = requests.Request("GET", httpbin("get"))
prep = ses.prepare_request(req)
- assert 'Accept-Encoding' not in prep.headers
+ if not SKIP_HEADER:
+ assert "Accept-Encoding" not in prep.headers
+ else:
+ assert SKIP_HEADER == prep.headers["Accept-Encoding"]
def test_headers_preserve_order(self, httpbin):
"""Preserve order when headers provided as OrderedDict."""