Avoid override of headers by urllib3 when unset (#1502)

* Pass SKIP_HEADER const when header is unset

* Hide SKIP_HEADER constant when displaying headers

* Test that omits User-Agent
This commit is contained in:
Abdelhakim Qbaich authored and GitHub committed 2023-05-19 23:53:26 +02:00
1 parent 3664644722
commit cbe53ed79a
3 files changed
+15

No files matched your search

+8
View File
@@ -196,6 +196,14 @@ def test_unset_host_header(httpbin_both):
assert 'Host' not in r.json['headers'] # default Host unset
def test_unset_useragent_header(httpbin_both):
r = http('GET', httpbin_both + '/headers')
assert 'User-Agent' in r.json['headers'] # default User-Agent present
r = http('GET', httpbin_both + '/headers', 'User-Agent:')
assert 'User-Agent' not in r.json['headers'] # default User-Agent unset
def test_headers_empty_value(httpbin_both):
r = http('GET', httpbin_both + '/headers')
assert r.json['headers']['Accept'] # default Accept has value