Add compression support #66
Merged
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 pull request adds support for additional content encodings (zstd and brotli) in HTTP request and response handling, improves the robustness of content encoding/decoding logic, and updates dependencies accordingly. The changes affect both the core functionality in
src/oapi/client.pyand the project configuration to ensure the new features work out-of-the-box.Content Encoding/Decoding Enhancements:
_encode_contentand_decode_contenthelper functions to support gzip, zstd, and brotli (including brotlicffi fallback) for encoding and decoding HTTP request and response bodies, including proper handling of multiple/stacked encodings.src/oapi/client.pyto use the new helpers, ensuring that content is automatically encoded or decoded based on theContent-Encodingheader. [1] [2] [3] [4] [5] [6]Dependency and Packaging Updates:
zstandard,brotli, andbrotlicffias optional dependencies inpyproject.toml, and included them in theallfeature for easy installation.sobto2.2and bumped the package version to2.8.0. [1] [2]upgradetarget in theMakefileto include theallfeature, ensuring all optional dependencies are handled during upgrades.features = ["all"]entry to the default environment inpyproject.tomlto ensure all features are available in development and CI.Other Improvements:
--compressedto curl options in the request callback, now enabling it for anyContent-Encodingheader (not just gzip).