After an upgrade of cachecontrol from 0.12.6 to 0.12.8 we experience empty response bodies on cache hits.
I've created a script that can reproduce the issue:
#!/usr/bin/env python3
import sys
import cachecontrol
import requests
from cachecontrol.cache import DictCache
from cachecontrol.heuristics import BaseHeuristic
class NoAgeHeuristic(BaseHeuristic):
def update_headers(self, response):
if "cache-control" in response.headers:
del response.headers["cache-control"]
cache_adapter = cachecontrol.CacheControlAdapter(
DictCache(), cache_etags=True, heuristic=NoAgeHeuristic()
)
session = requests.Session()
session.mount("https://", cache_adapter)
for i in range(2):
response = session.get(
"https://api.github.com/repos/sigmavirus24/github3.py/pulls/1033"
)
print(f'Content length: {len(response.content)}')
if len(response.content) == 0:
sys.exit(1)
When bisecting using the reproducer this issue seems to get introduced by add2e52
After an upgrade of cachecontrol from 0.12.6 to 0.12.8 we experience empty response bodies on cache hits.
I've created a script that can reproduce the issue:
When bisecting using the reproducer this issue seems to get introduced by add2e52