GZipMiddleware appears to not honor minimize_size #1253
-
I have installed My testing, however, shows that the responses are always compressed and Debugging the code, I see async def stream_response(self, send: Send) -> None:
await send(
{
"type": "http.response.start",
"status": self.status_code,
"headers": self.raw_headers,
}
)
async for chunk in self.body_iterator:
if not isinstance(chunk, bytes):
chunk = chunk.encode(self.charset)
await send({"type": "http.response.body", "body": chunk, "more_body": True})
await send({"type": "http.response.body", "body": b"", "more_body": False}) As a result, the key block of code in if len(body) < self.minimum_size and not more_body:
# Don't apply GZip to small outgoing responses.
await self.send(self.initial_message)
await self.send(message) Since |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I've created #2003 from this discussion to make an investigation. Thanks. 👍 |
Beta Was this translation helpful? Give feedback.
I've created #2003 from this discussion to make an investigation. Thanks. 👍