Skip to main content

patch_vary_headers

Add (or update) the "Vary" header in the given HttpResponse object. newheaders is a list of header names that should be in "Vary". If headers contains an asterisk, then "Vary" header will consist of a single asterisk '*'. Otherwise, existing headers in "Vary" aren't removed.

def patch_vary_headers(
response: HttpResponse,
newheaders: list
) - > null

Add (or update) the "Vary" header in the given HttpResponse object. newheaders is a list of header names that should be in "Vary". If headers contains an asterisk, then "Vary" header will consist of a single asterisk '*'. Otherwise, existing headers in "Vary" aren't removed.

Parameters

NameTypeDescription
responseHttpResponseThe HTTP response object whose headers will be modified.
newheaderslistA list of header names to be added to the Vary header, ensuring they are not duplicated while preserving original order.

Returns

TypeDescription
nullThe function modifies the response object in-place and does not return a value.