Repository navigation
Conversation
…ingle --compress flag This adds end-to-end JSON and raw-body cases with a single --compress flag, which tests the normal case where compression occurs because the result is smaller.
vinayK34
marked this pull request as ready for review
October 28, 2026 06:38
| 'foo=bar', | ||
| ) | ||
| assert HTTP_OK in r | ||
| assert r.json['headers']['Content-Encoding'] == 'deflate' |
There was a problem hiding this comment.
I think this new test conflicts with test_compress_skip_negative_ratio() earlier in the same file.
Both tests send the same small JSON payload (foo=bar) with a single --compress flag.
The existing test correctly expects no Content-Encoding header because compressing such a small payload increases its size. This new test expects deflate for the identical request, so the two assertions cannot both pass.
Could we use a larger, repetitive JSON payload here to make compression beneficial?
That would let this test cover the intended positive-compression case while preserving the existing negative-ratio behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds end-to-end JSON and raw-body cases over both HTTP and HTTPS. They check that the server receives
Content-Encoding: deflate, that decompression restores the original payload, and thatContent-Lengthequals the compressed byte count.The tests cover the normal case where one
--compressflag compresses a body because the result is smaller, which was missing from the existing compression suite.test_compress_json_normal()for JSON body compression with single flagtest_compress_raw_normal()for raw body compression with single flagThese tests verify that when using one
--compressflag, the body gets compressed only when the compressed version is smaller than the original.