Skip to content

Commit 9b8ae27

Browse files
committed
get found from request context
1 parent 494d498 commit 9b8ae27

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/flask_caching/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,11 @@ def decorated_function(*args, **kwargs):
414414
if found and self.app.debug:
415415
logger.info(f"Cache used for key: {cache_key}")
416416
if response_hit_indication:
417+
g.flask_caching_hit_cache = found
417418

418419
def apply_caching(response):
419-
if found:
420-
response.headers["hit_cache"] = found
420+
if g.flask_caching_hit_cache:
421+
response.headers["hit_cache"] = g.flask_caching_hit_cache
421422
return response
422423

423424
self.app.after_request_funcs[None].append(apply_caching)

0 commit comments

Comments
 (0)