From 7f7252d1514bdf27a4f05df01daa78c738319fc2 Mon Sep 17 00:00:00 2001 From: long2ice Date: Wed, 6 Jan 2021 10:44:22 +0800 Subject: [PATCH] bug fix --- Makefile | 3 +++ fastapi_cache/decorator.py | 2 +- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d6b9802..021a58c 100644 --- a/Makefile +++ b/Makefile @@ -35,4 +35,7 @@ test: deps build: deps @poetry build +clean: + @rm -rf ./dist + ci: check test diff --git a/fastapi_cache/decorator.py b/fastapi_cache/decorator.py index 93d1363..ee469a9 100644 --- a/fastapi_cache/decorator.py +++ b/fastapi_cache/decorator.py @@ -27,7 +27,7 @@ def cache( nonlocal expire nonlocal key_builder request = kwargs.get("request") - if request.headers.get("Cache-Control") == "no-store": + if request and request.headers.get("Cache-Control") == "no-store": return await func(*args, **kwargs) coder = coder or FastAPICache.get_coder() diff --git a/pyproject.toml b/pyproject.toml index 9ad6bf9..ee6242c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fastapi-cache2" -version = "0.1.3" +version = "0.1.3.1" description = "Cache for FastAPI" authors = ["long2ice "] license = "Apache-2.0"