patch_cache_control
Patch the Cache-Control header by adding all keyword arguments to it. The transformation is as follows:
* All keyword parameter names are turned to lowercase, and underscores
are converted to hyphens.
* If the value of a parameter is True (exactly True, not just a
true value), only the parameter name is added to the header.
* All other parameters are added with their value, after applying
str() to it.
def patch_cache_control(
response: HttpResponse,
**kwargs: Any
) - > null
Patch the Cache-Control header by adding all keyword arguments to it. The transformation is as follows:
- All keyword parameter names are turned to lowercase, and underscores are converted to hyphens.
- If the value of a parameter is True (exactly True, not just a true value), only the parameter name is added to the header.
- All other parameters are added with their value, after applying str() to it.
Parameters
| Name | Type | Description |
|---|---|---|
| response | HttpResponse | The HTTP response object whose 'Cache-Control' header will be modified. |
| **kwargs | Any | Directives to add to the Cache-Control header, where keys are directive names (underscores converted to hyphens) and values are directive arguments. |
Returns
| Type | Description |
|---|---|
null | The function modifies the response object in-place and does not return a value. |