patch_response_headers
Add HTTP caching headers to the given HttpResponse: Expires and Cache-Control.
Each header is only added if it isn't already set.
cache_timeout is in seconds. The CACHE_MIDDLEWARE_SECONDS setting is used
by default.
def patch_response_headers(
response: HttpResponse,
cache_timeout: int = None
) - > null
Add HTTP caching headers to the given HttpResponse: Expires and Cache-Control. Each header is only added if it isn't already set.
Parameters
| Name | Type | Description |
|---|---|---|
| response | HttpResponse | The HTTP response object to which the caching headers will be applied. |
| cache_timeout | int = None | The time in seconds for which the response should be cached; defaults to the CACHE_MIDDLEWARE_SECONDS setting. |
Returns
| Type | Description |
|---|---|
null | None; the response object is modified in-place. |