Skip to content

Commit a101657

Browse files
authored
Merge pull request #221 from Ishrock/master
add patch as invalidating http method
2 parents c774f39 + 7ed0b1b commit a101657

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cachecontrol/adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class CacheControlAdapter(HTTPAdapter):
17-
invalidating_methods = {"PUT", "DELETE"}
17+
invalidating_methods = {"PUT", "PATCH", "DELETE"}
1818

1919
def __init__(
2020
self,

tests/test_adapter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ def test_put_invalidates_cache(self, url, sess):
4949
sess.get(url)
5050
assert not r2.from_cache
5151

52+
def test_patch_invalidates_cache(self, url, sess):
53+
r2 = sess.patch(url, data={"foo": "bar"})
54+
sess.get(url)
55+
assert not r2.from_cache
56+
5257
def test_delete_invalidates_cache(self, url, sess):
5358
r2 = sess.delete(url)
5459
sess.get(url)

0 commit comments

Comments
 (0)