Xuanwo opened a new pull request, #9283:
URL: https://github.com/apache/opendal/pull/9283
# Which issue does this PR close?
Refs #6274.
# Rationale for this change
Six `Operator::presign_*` rustdoc examples rebuilt an `http::Request` using
only `signed_req.method()` and `signed_req.uri()`, discarding the `HeaderMap`
returned on `PresignedRequest`. Callers copying that pattern drop required or
conditional headers—for instance, `presign_stat_options` sets `if_match:
Some("<etag>".to_string())`, so building the request without the returned
headers silently drops `If-Match` (and similarly drops headers such as
`Cache-Control` or `Content-Type` returned by `presign_write_with` and
`presign_write_options`).
In addition, three prose snippets in `Operator`'s presign docs referenced a
non-existent `signed_req.headers()` method instead of
`PresignedRequest::header()`, and the `presign_read` `curl` download command
passed `-O /tmp/test.txt` (where `-O` takes no path argument) instead of `-o
/tmp/test.txt`.
# What changes are included in this PR?
Documentation-only changes in `core/core/src/types/operator/operator.rs`:
- Replace manual `http::Request::builder()` calls in six `Operator` presign
rustdoc examples (`presign_stat`, `presign_stat_options`,
`presign_read_options`, `presign_write_with`, `presign_write_options`, and
`presign_delete_options`) with `let req: http::Request<()> =
signed_req.into();`, using the existing `From<PresignedRequest> for
http::Request<T>` conversion (`core/core/src/raw/rps.rs`) so the full returned
`HeaderMap` is preserved.
- Correct `signed_req.headers()` to `signed_req.header()` in the prose for
`presign_read`, `presign_write`, and `presign_delete`.
- Correct the `presign_read` `curl` download flag from `-O /tmp/test.txt` to
`-o /tmp/test.txt` (the `presign_write` `PUT` and `presign_delete` `DELETE`
`curl` commands were already correct and are unchanged).
Verification on final commit `b671f72d65`: all 11 `Operator::presign_*`
doctests in `opendal-core` passed; a local conversion check confirmed
`PresignedRequest::into()` preserves `HEAD`, URI/query, `If-Match`, and
multi-value `Cache-Control` headers while the previous builder dropped headers;
and loopback `curl` checks exercised the documented GET (`-o`), PUT, and DELETE
commands.
# Are there any user-facing changes?
Documentation only (`core/core/src/types/operator/operator.rs`). No runtime
code or public API changes.
# Breaking changes
# AI Usage Statement
- **Harness:** Pi (via T3 Code)
**Model:** `magpie/codex/gpt-6.2-sol`
**Effort:** `max`
**Role:** Authored the documentation changes in
`core/core/src/types/operator/operator.rs` and ran the doctest,
`PresignedRequest` conversion, and loopback `curl` GET/PUT/DELETE verification
on commit `b671f72d65`.
- **Harness:** Pi (via T3 Code)
**Model:** `magpie/codex/gpt-6.2-sol`
**Effort:** `high`
**Role:** Independently reviewed the final docs diff and verification
evidence.
- **Harness:** Pi (via T3 Code)
**Model:** `magpie/codex/gpt-6.2-astra`
**Effort:** `high`
**Role:** Coordinated scoping, incremental diff review, and publication
handoff.
- **Harness:** Pi (via T3 Code)
**Model:** Gemini 4 Neon
**Effort:** `high`
**Role:** Verified publication preflight (commit signature, tree, base
commit, duplicate PRs, and GitHub Actions queue), drafted this PR description,
and published the PR. Verification covers docs compilation/doctests, local
`PresignedRequest` conversion, and loopback `curl` checks only (no remote
storage service requests).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]