MCPcopy Create free account
hub / github.com/psf/cachecontrol / update_headers

Method update_headers

cachecontrol/heuristics.py:66–77  ·  view source on GitHub ↗
(self, response: HTTPResponse)

Source from the content-addressed store, hash-verified

64 """
65
66 def update_headers(self, response: HTTPResponse) -> dict[str, str]:
67 headers = {}
68
69 if "expires" not in response.headers:
70 date = parsedate(response.headers["date"])
71 expires = expire_after(
72 timedelta(days=1),
73 date=datetime(*date[:6], tzinfo=timezone.utc), # type: ignore[index,misc]
74 )
75 headers["expires"] = datetime_to_header(expires)
76 headers["cache-control"] = "public"
77 return headers
78
79
80class ExpiresAfter(BaseHeuristic):

Callers

nothing calls this directly

Calls 2

expire_afterFunction · 0.85
datetime_to_headerFunction · 0.70

Tested by

no test coverage detected