Make the response object ready to be pickled. Does the following: * Buffer the response into a list, ignoring :attr:`implicity_sequence_conversion` and :attr:`direct_passthrough`. * Set the ``Content-Length`` header. * Generate an ``ETag
(self)
| 411 | self.close() |
| 412 | |
| 413 | def freeze(self) -> None: |
| 414 | """Make the response object ready to be pickled. Does the |
| 415 | following: |
| 416 | |
| 417 | * Buffer the response into a list, ignoring |
| 418 | :attr:`implicity_sequence_conversion` and |
| 419 | :attr:`direct_passthrough`. |
| 420 | * Set the ``Content-Length`` header. |
| 421 | * Generate an ``ETag`` header if one is not already set. |
| 422 | |
| 423 | .. versionchanged:: 2.1 |
| 424 | Removed the ``no_etag`` parameter. |
| 425 | |
| 426 | .. versionchanged:: 2.0 |
| 427 | An ``ETag`` header is always added. |
| 428 | |
| 429 | .. versionchanged:: 0.6 |
| 430 | The ``Content-Length`` header is set. |
| 431 | """ |
| 432 | # Always freeze the encoded response body, ignore |
| 433 | # implicit_sequence_conversion and direct_passthrough. |
| 434 | self.response = list(self.iter_encoded()) |
| 435 | self.headers["Content-Length"] = str(sum(map(len, self.response))) |
| 436 | self.add_etag() |
| 437 | |
| 438 | def get_wsgi_headers(self, environ: WSGIEnvironment) -> Headers: |
| 439 | """This is automatically called right before the response is started |