Sets the ``Etag`` header based on static url version. This allows efficient ``If-None-Match`` checks against cached versions, and sends the correct ``Etag`` for a partial response (i.e. the same ``Etag`` as the full file). .. versionadded:: 3.1
(self)
| 2687 | assert self.request.method == "HEAD" |
| 2688 | |
| 2689 | def compute_etag(self) -> Optional[str]: |
| 2690 | """Sets the ``Etag`` header based on static url version. |
| 2691 | |
| 2692 | This allows efficient ``If-None-Match`` checks against cached |
| 2693 | versions, and sends the correct ``Etag`` for a partial response |
| 2694 | (i.e. the same ``Etag`` as the full file). |
| 2695 | |
| 2696 | .. versionadded:: 3.1 |
| 2697 | """ |
| 2698 | assert self.absolute_path is not None |
| 2699 | version_hash = self._get_cached_version(self.absolute_path) |
| 2700 | if not version_hash: |
| 2701 | return None |
| 2702 | return '"%s"' % (version_hash,) |
| 2703 | |
| 2704 | def set_headers(self) -> None: |
| 2705 | """Sets the content and caching headers on the response. |
nothing calls this directly
no test coverage detected