Repository navigation
Support gzip-compressed HTTP responses - #159
Conversation
diazona
left a comment
There was a problem hiding this comment.
Looks good, thanks for the contribution! I had just a few minor suggestions.
Also, assuming nobody objects to the proposed LLM policy in #161, just make sure to add the appropriate disclosure (Assisted-by in the commit and some sort of mention in the PR description).
cc30e88 to
5fa1d13
Compare
|
Thanks for the review @diazona. I pushed a new commit with the changes:
I also updated the PR description to mention the AI assistance, and both commits have an Assisted-by trailer. |
diazona
left a comment
There was a problem hiding this comment.
Thanks! I'm good to proceed with this now. Sorry it took me a few days to get back to this.
|
Oh, actually one more thing, would you mind squashing commits? It's not really a big deal, but we like the commit history to be broken down in a useful way even after merging, and "Address review feedback" isn't really a useful commit to have on its own. |
serve_content() now accepts compress=Compression.GZIP, matching the old unfinished compress attribute. The body is gzipped and sent with Content-Encoding: gzip and the correct Content-Length, but only when the request's Accept-Encoding header allows it. Assisted-by: Cursor Agent with Grok 4.7
953f6d6 to
7dbc028
Compare
|
Squashed into a single commit, thanks for the review! |
Closes #27
The HTTP server already had a compress attribute and a FIXME to gzip the response body, but that code was never finished.
There's now a Compression enum in pytest_localserver.http (currently just Compression.GZIP), and serve_content() accepts compress=Compression.GZIP. You can also set httpserver.compress the same way. When the request's Accept-Encoding header allows gzip, the body is compressed and sent with Content-Encoding: gzip and the correct Content-Length. Compression stays off by default, so existing tests are unchanged.
I used an AI assistant (Cursor Agent with Grok 4.7) while writing this change. I reviewed the code myself, and the commits carry Assisted-by trailers.