Skip to content

feat: re-export reqwest and add opt-in reqwest-gzip feature#79

Merged
digizeph merged 2 commits into
mainfrom
dev/reqwest-reexport-http-gzip
Jul 23, 2026
Merged

feat: re-export reqwest and add opt-in reqwest-gzip feature#79
digizeph merged 2 commits into
mainfrom
dev/reqwest-reexport-http-gzip

Conversation

@digizeph

Copy link
Copy Markdown
Member

Summary

Re-exports reqwest as oneio::reqwest (under the http feature) and adds an opt-in reqwest-gzip feature enabling reqwest's transparent gzip content-encoding.

Motivation: oneio's public API already exposes reqwest types (OneIo::get_http_reader_raw() returns reqwest::blocking::Response, the builder exposes http_client()), but downstream crates cannot name those types without declaring their own reqwest dependency — risking version skew. Separately, oneio's reqwest build does not enable gzip, so payload-gzipped endpoints (e.g. https://rpki.cloudflare.com/rpki.json: ~97 MB plain, ~4.6 MB gzipped) cannot benefit; oneio's own decompression is URL-suffix-based. Concrete downstream need: bgpkit/bgpkit-commons#33 (conditional RPKI loading, bgpkit/bgpkit-commons#34).

Related Spec

specs/03-reqwest-reexport-http-gzip/README.md

Changes

  • pub use reqwest; (gated on http) with doc example showing a conditional-GET workflow (If-None-Match304, reading ETag/Last-Modified). Semver implication documented: reqwest becomes part of the public API contract, so a future reqwest major bump is a breaking oneio change — acceptable since the types already leak in public signatures.
  • reqwest-gzip = ["http", "reqwest/gzip"] feature: pure passthrough, no cfg-gated code. Advertises Accept-Encoding: gzip, transparently decodes responses. Off by default — verified flate2 absent from cargo tree without the feature, present with it. Named to disambiguate from the gz family (suffix-based file decompression); pattern extends to reqwest-brotli/reqwest-deflate later.
  • Tests (tests/http_advanced_tests.rs, in-process mock server, no external network):
    • test_reqwest_reexport_conditional_get — 200 with ETag capture via oneio::reqwest::header::ETAG, then If-None-MatchStatusCode::NOT_MODIFIED
    • test_reqwest_gzip_transparent_decode — gzipped body + Content-Encoding: gzip decodes transparently; asserts the request advertised Accept-Encoding: gzip
  • Docs: crate-level feature table, README feature list, README builder example updated to oneio::reqwest::header, CHANGELOG entry.
  • CI: build leg for reqwest-gzip,rustls and a test leg running the new integration tests.

Testing

  • cargo test --features reqwest-gzip --test http_advanced_tests: 2 passed
  • cargo test --all-features: all suites pass (43 + 24 + 10 + 9 + 2 passed, 0 failed)
  • cargo test --doc --all-features: pass (includes the new re-export doc example)
  • cargo fmt --check, cargo clippy --all-features -- -D warnings, cargo clippy --no-default-features -- -D warnings: clean
  • cargo tree check: no gzip decoder crates without the feature; flate2/async-compression present with it

Checklist

  • Tests pass
  • CHANGELOG.md updated
  • Documentation updated
  • Spec completed (specs/03-reqwest-reexport-http-gzip/)

Re-export reqwest as oneio::reqwest (under the http feature) so
downstream crates can name HTTP types exposed in oneio's public API
(StatusCode, header, blocking::Response) without declaring their own
reqwest dependency and risking version skew.

Add opt-in reqwest-gzip feature that enables reqwest's gzip
content-encoding: requests advertise Accept-Encoding: gzip and gzipped
responses are transparently decoded. Off by default, so dependency
trees are unchanged unless explicitly enabled. Distinct from the gz
family, which is URL-suffix-based file decompression.

Motivation: bgpkit-commons#33 (conditional RPKI loading) currently
needs a direct reqwest dependency solely to name these types and
enable gzip.
Copilot AI review requested due to automatic review settings July 23, 2026 00:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes reqwest (used by oneio’s HTTP implementation) directly nameable by downstream crates via oneio::reqwest and adds an opt-in feature to enable reqwest’s transparent gzip content-encoding support, improving ergonomics and reducing dependency/version-skew risk for consumers.

Changes:

  • Re-export reqwest as oneio::reqwest behind the http feature, with crate docs demonstrating conditional GET usage.
  • Add reqwest-gzip feature (["http", "reqwest/gzip"]) and document it across crate docs/README/CHANGELOG.
  • Add integration tests for the re-export usage and gzip transparent decoding; extend CI to build/test the new feature combo.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/http_advanced_tests.rs Adds mock-server integration tests for oneio::reqwest usage and gzip transparent decoding under reqwest-gzip.
src/lib.rs Documents reqwest-gzip and introduces #[cfg(feature = "http")] pub use reqwest; re-export with example.
specs/README.md Adds spec index entry for the new feature/spec.
specs/03-reqwest-reexport-http-gzip/README.md Adds the detailed design spec for reqwest re-export + opt-in gzip.
README.md Documents reqwest-gzip and updates examples to use oneio::reqwest types.
CHANGELOG.md Records the new public re-export and reqwest-gzip feature under Unreleased.
Cargo.toml Introduces the reqwest-gzip feature forwarding to reqwest/gzip.
.github/workflows/rust.yml Adds CI build and test legs for reqwest-gzip (and its integration tests).

Comment thread specs/README.md Outdated
Comment thread specs/03-reqwest-reexport-http-gzip/README.md Outdated
Copilot AI review requested due to automatic review settings July 23, 2026 01:09
@digizeph
digizeph enabled auto-merge July 23, 2026 01:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment on lines +31 to +35
loop {
let bytes_read = stream.read(&mut buffer).unwrap();
if bytes_read == 0 {
break;
}
Comment on lines +20 to +28
**Success criteria:**
- [ ] `oneio::reqwest` resolves when the `http` feature is enabled (e.g.
`oneio::reqwest::StatusCode::NOT_MODIFIED` compiles downstream)
- [ ] With `reqwest-gzip`, requests advertise `Accept-Encoding: gzip` and
`Content-Encoding: gzip` responses are transparently decoded
- [ ] Without `reqwest-gzip`, dependency tree is unchanged (no gzip decoder crates)
- [ ] Conditional-GET workflow (send `If-None-Match`, read `304` status and
`ETag`/`Last-Modified` response headers) is possible using only oneio's API
- [ ] All quality gates pass: fmt, build, test, clippy (`-D warnings`)
@digizeph
digizeph merged commit fd47980 into main Jul 23, 2026
7 checks passed
@digizeph
digizeph deleted the dev/reqwest-reexport-http-gzip branch July 23, 2026 01:15
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