def test_etag_parsing_helper(self, asgi, header_value): # NOTE(kgriffs): Test a couple of cases that are not directly covered # elsewhere (but that we want the helper to still support # for the sake of avoiding suprises if they are ever called without # preflighting the header value). assert _parse_etags(header_value) is None
def if_none_match(self): if self._cached_if_none_match is None: header_value = self._asgi_headers.get('if-none-match') if header_value: self._cached_if_none_match = helpers._parse_etags(header_value) return self._cached_if_none_match
def test_etag_parsing_helper(self, header_value): # NOTE(kgriffs): Test a couple of cases that are not directly covered # elsewhere (but that we want the helper to still support # for the sake of avoiding suprises if they are ever called without # preflighting the header value). assert _parse_etags(header_value) is None
def if_match(self): # TODO(kgriffs): It may make sense at some point to create a # header property generator that DRY's up the memoization # pattern for us. # PERF(kgriffs): It probably isn't worth it to set # self._cached_if_match to a special type/object to distinguish # between the variable being unset and the header not being # present in the request. The reason is that if the app # gets a None back on the first reference to property, it # probably isn't going to access the property again (TBD). if self._cached_if_match is None: header_value = self._asgi_headers.get('if-match') if header_value: self._cached_if_match = helpers._parse_etags(header_value) return self._cached_if_match