From f9cef77cedffc7af3d6ac0ad81b56724756b9c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B5=AC?= <99sphere@gmail.com> Date: Sun, 30 Mar 2025 17:17:42 +0900 Subject: [PATCH 1/2] fix: recognize POST method as cacheable --- fastapi_cache/decorator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastapi_cache/decorator.py b/fastapi_cache/decorator.py index 7df09e88..c958579d 100644 --- a/fastapi_cache/decorator.py +++ b/fastapi_cache/decorator.py @@ -79,7 +79,7 @@ def _uncacheable(request: Optional[Request]) -> bool: return True if request is None: return False - if request.method != "GET": + if request.method not in ["GET", "POST"]: return True return request.headers.get("Cache-Control") == "no-store" From af0d61320eccf222a8c9f13343fa86f835471852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B5=AC?= <99sphere@gmail.com> Date: Sat, 10 May 2025 14:58:32 +0900 Subject: [PATCH 2/2] chore: fix comments --- fastapi_cache/decorator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastapi_cache/decorator.py b/fastapi_cache/decorator.py index c958579d..378fe7dd 100644 --- a/fastapi_cache/decorator.py +++ b/fastapi_cache/decorator.py @@ -71,7 +71,7 @@ def _uncacheable(request: Optional[Request]) -> bool: Returns true if: - Caching has been disabled globally - - This is not a GET request + - This is not a GET or POST request - The request has a Cache-Control header with a value of "no-store" """