werkzeug.ETagResponseMixin.make_conditional

ETagResponseMixin.make_conditional(request_or_environ)[source]

Make the response conditional to the request. This method works best if an etag was defined for the response already. The add_etag method can be used to do that. If called without etag just the date header is set.

This does nothing if the request method in the request or environ is anything but GET or HEAD.

It does not remove the body of the response because that’s something the __call__() function does for us automatically.

Returns self so that you can do return resp.make_conditional(req) but modifies the object in-place.

Parameters:request_or_environ – a request object or WSGI environment to be used to make the response conditional against.