diff options
author | Jordan Cook <jordan.cook@pioneer.com> | 2022-04-10 14:15:15 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook@pioneer.com> | 2022-04-10 14:19:40 -0500 |
commit | 4a593b0c16aa96d5912fb6605dec46b0dc4bf66e (patch) | |
tree | cb87132587b91903eeae8b7c1a2165c5319e9f18 /requests_cache/cache_keys.py | |
parent | 4b7e4789856f5c6b9e4d3be1955fa55c97e427ec (diff) | |
download | requests-cache-4a593b0c16aa96d5912fb6605dec46b0dc4bf66e.tar.gz |
Remove 'default exclude headers', since match_headers now accepts a list of specific headers to match
Diffstat (limited to 'requests_cache/cache_keys.py')
-rw-r--r-- | requests_cache/cache_keys.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/requests_cache/cache_keys.py b/requests_cache/cache_keys.py index e28d533..8a1582c 100644 --- a/requests_cache/cache_keys.py +++ b/requests_cache/cache_keys.py @@ -22,9 +22,6 @@ __all__ = ['create_key', 'normalize_request'] if TYPE_CHECKING: from .models import AnyPreparedRequest, AnyRequest, CachedResponse -# Request headers that are always excluded from cache keys, but not redacted from cached responses -DEFAULT_EXCLUDE_HEADERS = {'Cache-Control', 'If-None-Match', 'If-Modified-Since'} - # Maximum JSON request body size that will be normalized MAX_NORM_BODY_SIZE = 10 * 1024 * 1024 @@ -78,15 +75,11 @@ def get_matched_headers( """ if not match_headers: return [] - - if isinstance(match_headers, Iterable): - included = set(match_headers) - DEFAULT_EXCLUDE_HEADERS - else: - included = set(headers) - DEFAULT_EXCLUDE_HEADERS - + if match_headers is True: + match_headers = headers return [ f'{k.lower()}={headers[k]}' - for k in sorted(included, key=lambda x: x.lower()) + for k in sorted(match_headers, key=lambda x: x.lower()) if k in headers ] |