'Call this method if you want to make your response object ready for
being pickled.  This buffers the generator if there is one.  It will
also set the `Content-Length` header to the length of the body.
.. versionchanged:: 0.6
The `Content-Length` header is now set.'

def freeze(self):

    self.response = list(self.iter_encoded())
    self.headers['Content-Length'] = str(sum(map(len, self.response)))
