Skip to content

Commit 1826376

Browse files
authored
Merge branch 'main' into expose-inner-reqwest-client
2 parents 89223bc + 2ab1ad1 commit 1826376

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ jobs:
3131
uses: taiki-e/install-action@cargo-hack
3232
- name: test
3333
run: cargo hack test --feature-powerset -p reqwest-middleware
34+
check-wasm32-reqwest-middleware:
35+
name: Run `cargo check` for `reqwest-middleware` on `wasm32-unknown-unknown`
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
- name: Install Rust
41+
uses: dtolnay/rust-toolchain@stable
42+
- uses: actions-rs/cargo@v1
43+
with:
44+
command: build
45+
args: --target wasm32-unknown-unknown -p reqwest-middleware --all-features
3446
test-features-retry:
3547
name: Run test suite for `reqwest-retry` with every feature combination
3648
runs-on: ubuntu-latest

reqwest-middleware/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
- Fixed wasm32 by disabling incompatible parts. On that target, `ClientWithMiddleware` is no longer
9+
a Tower service and has no `ClientWithMiddleware::timeout` function.
810

911
- Implemented `AsRef<Client>` for `ClientWithMiddleware`. Allows access to the inner `reqwest::Client` ([#209](https://github.com/TrueLayer/reqwest-middleware/pull/209))
1012

reqwest-middleware/src/client.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ impl AsRef<Client> for ClientWithMiddleware {
256256
}
257257
}
258258

259+
#[cfg(not(target_arch = "wasm32"))]
259260
mod service {
260261
use std::{
261262
future::Future,
@@ -431,6 +432,7 @@ impl RequestBuilder {
431432
/// The timeout is applied from when the request starts connecting until the
432433
/// response body has finished. It affects only this request and overrides
433434
/// the timeout configured using `ClientBuilder::timeout()`.
435+
#[cfg(not(target_arch = "wasm32"))]
434436
pub fn timeout(self, timeout: std::time::Duration) -> Self {
435437
RequestBuilder {
436438
inner: self.inner.timeout(timeout),

0 commit comments

Comments
 (0)