Skip to content

feat(wasm): add Response extensions and version accessors - #3145

Open
CharoenwitKunna wants to merge 5 commits into
seanmonstar:masterfrom
CharoenwitKunna:wasm-response-extensions-2835
Open

CharoenwitKunna wants to merge 5 commits into
seanmonstar:masterfrom
CharoenwitKunna:wasm-response-extensions-2835

Conversation

@CharoenwitKunna

Copy link
Copy Markdown

What this adds

The WASM Response type now exposes extensions(), extensions_mut() and version(), delegating to the inner http::Response, matching the native Response API. The version() method existed but was commented out behind a note questioning whether the version is detectable in JS.

Why

Issue #2835. The owner confirmed missing WASM methods are usually simply ones nobody has needed yet and invited a PR. In a browser build the underlying http::Response is created by a builder without a wire version, so version() reports HTTP/1.1 (the same as native's default) ? this is API parity, not wire-version detection.

Scope

From<http::Response> is intentionally not included here: native fabricates a URL and builds an AbortGuard, neither of which has a clean WASM equivalent. Left for a separate design decision.

Verification

  • Adds accessors on the wasm-only module (#[cfg(target_arch = "wasm32")]); non-wasm builds are unaffected.
  • Doc comments are copied from the native equivalents. The crate has #![deny(missing_docs)], so these comments are required for the public methods to compile.
  • New wasm_bindgen_test in tests/wasm_simple.rs exercises version/extensions. WASM tests run in CI; not run locally.

Fixes #2835

@CharoenwitKunna
CharoenwitKunna force-pushed the wasm-response-extensions-2835 branch from 07e6f1e to 11ea959 Compare November 25, 2026 05:10
Signed-off-by: Chareonwit Kunna <21arenabreakout12@gmail.com>
Signed-off-by: Chareonwit Kunna <21arenabreakout12@gmail.com>
Signed-off-by: Chareonwit Kunna <21arenabreakout12@gmail.com>
Signed-off-by: Chareonwit Kunna <21arenabreakout12@gmail.com>
Signed-off-by: Chareonwit Kunna <21arenabreakout12@gmail.com>
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.

Response is missing methods on WASM

1 participant