MCPcopy Create free account
hub / github.com/EasyIME/PIME / should_return_304

Method should_return_304

python/python3/tornado/web.py:2729–2749  ·  view source on GitHub ↗

Returns True if the headers indicate that we should return 304. .. versionadded:: 3.1

(self)

Source from the content-addressed store, hash-verified

2727 self.set_extra_headers(self.path)
2728
2729 def should_return_304(self) -> bool:
2730 """Returns True if the headers indicate that we should return 304.
2731
2732 .. versionadded:: 3.1
2733 """
2734 # If client sent If-None-Match, use it, ignore If-Modified-Since
2735 if self.request.headers.get("If-None-Match"):
2736 return self.check_etag_header()
2737
2738 # Check the If-Modified-Since, and don't send the result if the
2739 # content has not been modified
2740 ims_value = self.request.headers.get("If-Modified-Since")
2741 if ims_value is not None:
2742 date_tuple = email.utils.parsedate(ims_value)
2743 if date_tuple is not None:
2744 if_since = datetime.datetime(*date_tuple[:6])
2745 assert self.modified is not None
2746 if if_since >= self.modified:
2747 return True
2748
2749 return False
2750
2751 @classmethod
2752 def get_absolute_path(cls, root: str, path: str) -> str:

Callers 1

getMethod · 0.95

Calls 2

check_etag_headerMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected