Skip to content

Conversation

@davebelais
Copy link
Collaborator

@davebelais davebelais commented Jan 16, 2026

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.py and the project configuration to ensure the new features work out-of-the-box.

Content Encoding/Decoding Enhancements:

  • Added _encode_content and _decode_content helper 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.
  • Updated request and response handling logic throughout src/oapi/client.py to use the new helpers, ensuring that content is automatically encoded or decoded based on the Content-Encoding header. [1] [2] [3] [4] [5] [6]
  • Improved detection of content type and encoding in request/response processing, making header lookups case-insensitive and more robust.

Dependency and Packaging Updates:

  • Added zstandard, brotli, and brotlicffi as optional dependencies in pyproject.toml, and included them in the all feature for easy installation.
  • Updated the minimum required version of sob to 2.2 and bumped the package version to 2.8.0. [1] [2]
  • Updated the upgrade target in the Makefile to include the all feature, ensuring all optional dependencies are handled during upgrades.
  • Added a features = ["all"] entry to the default environment in pyproject.toml to ensure all features are available in development and CI.

Other Improvements:

  • Simplified logic for adding --compressed to curl options in the request callback, now enabling it for any Content-Encoding header (not just gzip).

@davebelais davebelais changed the title Add request compression support Add compression support Jan 16, 2026
@davebelais davebelais merged commit b3d49d1 into main Jan 16, 2026
13 checks passed
@davebelais davebelais deleted the compression branch January 16, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants