We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://raw.githubusercontent.com/encode/starlette/master/starlette/middleware/gzip.py changed:
diff --git a/tracking/gzip.py b/tracking/gzip.py index 9d69ee7..cbb0f4a 100644 --- a/tracking/gzip.py +++ b/tracking/gzip.py @@ -33,6 +33,7 @@ class GZipResponder: self.send: Send = unattached_send self.initial_message: Message = {} self.started = False + self.content_encoding_set = False self.gzip_buffer = io.BytesIO() self.gzip_file = gzip.GzipFile( mode="wb", fileobj=self.gzip_buffer, compresslevel=compresslevel @@ -48,6 +49,13 @@ class GZipResponder: # Don't send the initial message until we've determined how to # modify the outgoing headers correctly. self.initial_message = message + headers = Headers(raw=self.initial_message["headers"]) + self.content_encoding_set = "content-encoding" in headers + elif message_type == "http.response.body" and self.content_encoding_set: + if not self.started: + self.started = True + await self.send(self.initial_message) + await self.send(message) elif message_type == "http.response.body" and not self.started: self.started = True body = message.get("body", b"")
Close this issue once those changes have been integrated here
The text was updated successfully, but these errors were encountered:
tracking/gzip.py updated, refs #4
5eae07a
Looks like that's this change: encode/starlette@858629f
From:
Content-Encoding
Sorry, something went wrong.
616a23e
Release 0.2
a0075e7
Refs #4
httpx as a test dependency, refs #4
1475c3f
Tweeted about this here: https://twitter.com/simonw/status/1580707619915718656
No branches or pull requests
https://raw.githubusercontent.com/encode/starlette/master/starlette/middleware/gzip.py changed:
Close this issue once those changes have been integrated here
The text was updated successfully, but these errors were encountered: