mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 09:13:23 +00:00
Make request.headers always a CaseInsensitiveDict.
Previously request.headers was a normal dict (albeit with the request.add_header interface) which meant that some code paths would do case-sensitive matching, for example remove_post_data_parameters which tests for 'Content-Type'. This change allows all code paths to get the same case-insensitive treatment. Additionally request.headers becomes a property to enforce upgrading it to a CaseInsensitiveDict even if assigned.
This commit is contained in:
@@ -17,11 +17,7 @@ def _request_with_auth(url, username, password):
|
||||
|
||||
|
||||
def _find_header(cassette, header):
|
||||
for request in cassette.requests:
|
||||
for k in request.headers:
|
||||
if header.lower() == k.lower():
|
||||
return True
|
||||
return False
|
||||
return any(header in request.headers for request in cassette.requests)
|
||||
|
||||
|
||||
def test_filter_basic_auth(tmpdir):
|
||||
|
||||
Reference in New Issue
Block a user