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

Method conditional_headers

cachecontrol/controller.py:279–292  ·  view source on GitHub ↗
(self, request: PreparedRequest)

Source from the content-addressed store, hash-verified

277 return False
278
279 def conditional_headers(self, request: PreparedRequest) -> dict[str, str]:
280 resp = self._load_from_cache(request)
281 new_headers = {}
282
283 if resp:
284 headers: CaseInsensitiveDict[str] = CaseInsensitiveDict(resp.headers)
285
286 if "etag" in headers:
287 new_headers["If-None-Match"] = headers["ETag"]
288
289 if "last-modified" in headers:
290 new_headers["If-Modified-Since"] = headers["Last-Modified"]
291
292 return new_headers
293
294 def _cache_set(
295 self,

Callers 1

sendMethod · 0.80

Calls 1

_load_from_cacheMethod · 0.95

Tested by

no test coverage detected