summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2022-01-01 11:56:42 -0600
committerJordan Cook <jordan.cook@pioneer.com>2022-01-01 11:59:08 -0600
commit99b77935f1eac273b27c495c10d906567ff75cc0 (patch)
tree8df10317b336cbcaaf3cd370df04983230b109c1
parent3d5f55d9d5ceee7084b2c0f30a3784d4ce056bdd (diff)
downloadrequests-cache-99b77935f1eac273b27c495c10d906567ff75cc0.tar.gz
Fix black and type checking issues, and update changelog
-rw-r--r--HISTORY.md1
-rw-r--r--requests_cache/cache_keys.py5
2 files changed, 4 insertions, 2 deletions
diff --git a/HISTORY.md b/HISTORY.md
index e6dcfc1..a3406bb 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -23,6 +23,7 @@
* Some micro-optimizations for request matching
**Bugfixes:**
+* Fix regression bug causing headers used for cache key to not guarantee sort order
* Handle some additional corner cases when normalizing request data
* Add support for `BaseCache` keyword arguments passed along with a backend instance
* Fix issue with cache headers not being used correctly if `cache_control=True` is used with an `expire_after` value
diff --git a/requests_cache/cache_keys.py b/requests_cache/cache_keys.py
index 662a87b..7029c7f 100644
--- a/requests_cache/cache_keys.py
+++ b/requests_cache/cache_keys.py
@@ -81,8 +81,9 @@ def get_matched_headers(
else:
included = set(headers) - DEFAULT_EXCLUDE_HEADERS
- included = sorted(included, key=lambda x:x.lower())
- return [f'{k.lower()}={headers[k]}' for k in included if k in headers]
+ return [
+ f'{k.lower()}={headers[k]}' for k in sorted(included, key=lambda x: x.lower()) if k in headers
+ ]
def normalize_request(request: AnyRequest, ignored_parameters: ParamList) -> AnyPreparedRequest: