Make the HTTP client backend used by Bucket pluggable
Traits are defined which backends must implement:
- The HTTP client `tower::Service` interface.
- The `ResponseBody` that the backend must return.
Minimal new dependencies are taken, notably `http-body` but not the whole `tower` crate, only the small crate with the trait definition.
All 3 built-in backends, Reqwest, Surf, and Atto, implement the necessary traits. Exactly one of them is compiled depending on feature flags and exposed as `DefaultBackend` so that everything works the same as before by default.
Future work will be 2 refactor some functionality such as retries and the `fail-on-err` feature as `tower::Layer` middleware.
This is a somewhat breaking change and so will require a semver bump but I tried to keep it as unintrusive as possible.
<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/durch/rust-s3/442)
<!-- Reviewable:end -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
## Release Notes
* **Breaking Changes**
* Updated Bucket type and related public method signatures; code using Bucket will require updates.
* Added new error type variant for invalid HTTP status codes.
* **New Features**
* Added new builder methods for fluent configuration of bucket settings.
* Enhanced error handling with improved status code validation.
<sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
合并状态:未合并 关闭于 2025-12-09 2 条评论