Method
apply_compression
starlette/middleware/gzip.py:132–141
· starlette/middleware/gzip.py::GZipResponder.apply_compression
(self, body: bytes, *, more_body: bool)
Source from the content-addressed store, hash-verified
| 130 | await super().__call__(scope, receive, send) |
| 131 | |
| 132 | def apply_compression(self, body: bytes, *, more_body: bool) -> bytes: |
| 133 | self.gzip_file.write(body) |
| 134 | if not more_body: |
| 135 | self.gzip_file.close() |
| 136 | |
| 137 | body = self.gzip_buffer.getvalue() |
| 138 | self.gzip_buffer.seek(0) |
| 139 | self.gzip_buffer.truncate() |
| 140 | |
| 141 | return body |
| 142 | |
| 143 | |
| 144 | async def unattached_send(message: Message) -> NoReturn: |
Callers
nothing calls this directly
Tested by
no test coverage detected