Skip to content

Commit

Permalink
patch content length issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jordant committed Mar 24, 2023
1 parent 233835b commit 7a682d1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/fastapi_redis_cache/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ async def inner_wrapper(*args, **kwargs):
create_response_directly = not response
if create_response_directly:
response = Response()
if "content-length" in response.headers.keys():
del response.headers["content-length"]
redis_cache = FastApiRedisCache()
if redis_cache.not_connected or redis_cache.request_is_not_cacheable(request):
# if the redis client is not connected or request is not cacheable, no caching behavior is performed.
Expand Down

0 comments on commit 7a682d1

Please sign in to comment.