Skip to content

feat: add middleware support to REST catalog client#1971

Closed
rohankmr414 wants to merge 7 commits intoapache:mainfrom
rohankmr414:rohan-patch-1
Closed

feat: add middleware support to REST catalog client#1971
rohankmr414 wants to merge 7 commits intoapache:mainfrom
rohankmr414:rohan-patch-1

Conversation

@rohankmr414
Copy link
Copy Markdown

This pull request adds support for HTTP middleware in the iceberg-catalog-rest crate, allowing users to inject custom middleware (such as logging, retries, or authentication) into HTTP requests using the reqwest-middleware crate. The implementation is feature-gated and includes documentation, configuration options, and tests for middleware support.

Middleware support:

  • Added an optional middleware feature to Cargo.toml that enables integration with the reqwest-middleware crate for custom HTTP middleware capabilities. [1] [2]
  • Extended the RestCatalogBuilder and RestCatalogConfig structs to support a middleware_client field, and provided a with_middleware_client method for configuration. [1] [2] [3]
  • Updated the internal HttpClient to use the middleware client when configured, including logic in the execute method to route requests through middleware if present. [1] [2] [3] [4]

Documentation:

  • Added a new section to the README.md with usage instructions and examples for enabling and using middleware support.

Testing:

  • Introduced new tests to verify middleware client integration and to demonstrate how custom middleware (such as request counting) can intercept requests.

Introduces an optional `middleware` feature to enable custom HTTP middleware for the REST catalog client.

This integration with `reqwest-middleware` allows users to inject custom logic into HTTP requests, facilitating advanced functionalities such as logging, retry mechanisms, rate limiting, and custom authentication.

A `with_middleware_client` method is added to `RestCatalogBuilder` for easy configuration.
Reorders import statements within a middleware test for better consistency and readability.
@rohankmr414
Copy link
Copy Markdown
Author

This change is required to support authentication headers in scenarios such as projected Kubernetes service account tokens. These tokens are rotated frequently (typically every hour), so it’s important for clients to be able to watch the token file and update the headers dynamically as the token changes. This middleware support will enable such use cases seamlessly.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 7, 2026

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Mar 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions Bot closed this Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants