diff --git a/cachecontrol/adapter.py b/cachecontrol/adapter.py index 4f4c185..3f9386c 100644 --- a/cachecontrol/adapter.py +++ b/cachecontrol/adapter.py @@ -24,7 +24,7 @@ class CacheControlAdapter(HTTPAdapter): - invalidating_methods = {"PUT", "PATCH", "DELETE"} + invalidating_methods = {"POST", "PUT", "PATCH", "DELETE"} def __init__( self, diff --git a/tests/test_adapter.py b/tests/test_adapter.py index 8a4f38e..cb4e754 100644 --- a/tests/test_adapter.py +++ b/tests/test_adapter.py @@ -62,6 +62,11 @@ def test_delete_invalidates_cache(self, url, sess): sess.get(url) assert not r2.from_cache + def test_post_invalidates_cache(self, url, sess): + sess.get(url) + sess.post(url, data={"foo": "bar"}) + assert not sess.get(url).from_cache + def test_close(self): cache = mock.Mock(spec=DictCache) sess = Session()