Skip to content

Commit 7ed0b1b

Browse files
committed
add patch as invalidating http method
1 parent 9d5c1f5 commit 7ed0b1b

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
@@ -10,7 +10,7 @@
1010

1111

1212
class CacheControlAdapter(HTTPAdapter):
13-
invalidating_methods = {"PUT", "DELETE"}
13+
invalidating_methods = {"PUT", "PATCH", "DELETE"}
1414

1515
def __init__(
1616
self,

tests/test_adapter.py

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

48+
def test_patch_invalidates_cache(self, url, sess):
49+
r2 = sess.patch(url, data={"foo": "bar"})
50+
sess.get(url)
51+
assert not r2.from_cache
52+
4853
def test_delete_invalidates_cache(self, url, sess):
4954
r2 = sess.delete(url)
5055
sess.get(url)

0 commit comments

Comments
 (0)