feat(requests): support custom amz headers#204
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a global -H/--header NAME:VALUE option that injects custom x-amz-* headers into both SDK-driven and manual XML S3 requests, signing them as part of SigV4.
Changes:
- New
RequestHeadertype plusset_global_request_headers/global_request_headers(process-wideOnceLock<RwLock<...>>) inrc-core, with parsing that enforces thex-amz-prefix and basic header validity. - New global Clap arg
request_headersparsed viaRequestHeader::parse;executepopulates the global before dispatch. S3Client::newreads the globals once, attaches aCustomHeaderInterceptor(modify_before_signing) for SDK calls and inserts headers into the manual XML signing path beforesign_xml_request.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/core/src/alias.rs | Defines RequestHeader and global header storage with parse-time validation. |
| crates/core/src/lib.rs | Re-exports the new header types/functions. |
| crates/cli/src/commands/mod.rs | Adds the -H/--header global flag, value parser, and seeds the global registry; adds parse-tests. |
| crates/cli/tests/help_contract.rs | Asserts --header appears in help output. |
| crates/s3/src/client.rs | Adds CustomHeaderInterceptor for SDK requests, applies headers before SigV4 in the manual XML path, plus a new SDK-path test. |
| docs/reference/rc/README.md | Documents the new -H/--header global option. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6d2e68877
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
e6d2e68 to
69aa18b
Compare
Related issue
Closes #199
Background
Some S3-compatible services require custom x-amz-* request headers for bucket or object operations. The CLI did not expose a way to pass those headers.
Solution
Validation