Skip to content

Commit 98480b8

Browse files
authored
Merge branch 'main' into expose-inner-reqwest-client
2 parents 1826376 + 0744f65 commit 98480b8

File tree

18 files changed

+398
-131
lines changed

18 files changed

+398
-131
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions-rs/cargo@v1
1818
with:
1919
command: test
20-
args: --workspace --all-targets --all-features
20+
args: --workspace --all-targets
2121

2222
test-features-reqwest-middleware:
2323
name: Run test suite for `reqwest-middleware` with every feature combination
@@ -39,6 +39,8 @@ jobs:
3939
uses: actions/checkout@v4
4040
- name: Install Rust
4141
uses: dtolnay/rust-toolchain@stable
42+
with:
43+
targets: wasm32-unknown-unknown
4244
- uses: actions-rs/cargo@v1
4345
with:
4446
command: build
@@ -67,7 +69,9 @@ jobs:
6769
uses: taiki-e/install-action@cargo-hack
6870
# Old opentelemetry features group to improve performance
6971
- name: test
70-
run: cargo hack test --feature-powerset -p reqwest-tracing --group-features opentelemetry_0_20,opentelemetry_0_21,opentelemetry_0_22
72+
run: cargo hack test --feature-powerset -p reqwest-tracing --exclude-features opentelemetry_0_20 --group-features opentelemetry_0_21,opentelemetry_0_22,opentelemetry_0_23,opentelemetry_0_24,opentelemetry_0_25,opentelemetry_0_26,opentelemetry_0_27
73+
env:
74+
CARGO_PROFILE_DEV_DEBUG: "line-tables-only"
7175

7276
rustfmt:
7377
name: Rustfmt

.github/workflows/release-plz.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release-plz
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release-plz-release:
10+
name: Release-plz release
11+
runs-on: ubuntu-latest
12+
if: ${{ github.repository_owner == 'TrueLayer' }}
13+
permissions:
14+
contents: write
15+
id-token: write
16+
steps:
17+
- &checkout
18+
name: Checkout repository
19+
uses: actions/checkout@v6
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: true
23+
- &install-rust
24+
name: Install Rust toolchain
25+
uses: dtolnay/rust-toolchain@stable
26+
- name: Run release-plz
27+
uses: release-plz/action@v0.5
28+
with:
29+
command: release
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
release-plz-pr:
34+
name: Release-plz PR
35+
runs-on: ubuntu-latest
36+
if: ${{ github.repository_owner == 'TrueLayer' }}
37+
permissions:
38+
pull-requests: write
39+
contents: write
40+
concurrency:
41+
group: release-plz-${{ github.ref }}
42+
cancel-in-progress: false
43+
steps:
44+
- *checkout
45+
- *install-rust
46+
- name: Run release-plz
47+
uses: release-plz/action@v0.5
48+
with:
49+
command: release-pr
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ The `reqwest-middleware` client exposes the same interface as a plain `reqwest`
2929
# Cargo.toml
3030
# ...
3131
[dependencies]
32-
reqwest = { version = "0.12", features = ["rustls-tls"] }
33-
reqwest-middleware = "0.4"
34-
reqwest-retry = "0.7"
35-
reqwest-tracing = "0.5"
32+
reqwest = "0.13"
33+
reqwest-middleware = "0.5"
34+
reqwest-retry = "0.9"
35+
reqwest-tracing = "0.6"
3636
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
3737
```
3838

reqwest-middleware/CHANGELOG.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,38 @@ All notable changes to this project will be documented in this file.
44
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

7-
## [Unreleased]
7+
## [0.5.1](https://github.com/TrueLayer/reqwest-middleware/compare/reqwest-middleware-v0.5.0...reqwest-middleware-v0.5.1) - 2026-02-05
8+
9+
### Other
10+
11+
- Set changelog version for last release ([#268](https://github.com/TrueLayer/reqwest-middleware/pull/268))
12+
13+
## [0.5.0] - 2026-01-07
14+
15+
### Changed
16+
17+
- Updated `thiserror` to `2.0`
18+
- Updated `reqwest` to `0.13`
19+
- Renamed `rustls-tls` feature to `rustls` to match reqwest's feature naming
20+
- Added `form` feature, enables `reqwest/form`
21+
- Added `query` feature, enables `reqwest/query`
22+
- Made `serde` an optional dependency, enabled by `json`, `form`, or `query`
23+
24+
### Removed
25+
- Remove deprecated `fetch_mode_no_cors`
26+
27+
## [0.4.2] - 2025-04-08
28+
29+
### Added
30+
- Deprecated `fetch_mode_no_cors` as it's been deprecated in reqwest.
31+
32+
## [0.4.1] - 2025-02-24
33+
834
- Fixed wasm32 by disabling incompatible parts. On that target, `ClientWithMiddleware` is no longer
935
a Tower service and has no `ClientWithMiddleware::timeout` function.
1036

11-
- Implemented `AsRef<Client>` for `ClientWithMiddleware`. Allows access to the inner `reqwest::Client` ([#209](https://github.com/TrueLayer/reqwest-middleware/pull/209))
37+
### Changed
38+
- Updated `wasm-timer` to `wasmtimer`
1239

1340
## [0.4.0] - 2024-11-08
1441

reqwest-middleware/Cargo.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "reqwest-middleware"
3-
version = "0.4.0"
3+
version = "0.5.1"
44
authors = ["Rodrigo Gryzinski <rodrigo.gryzinski@truelayer.com>"]
55
edition = "2018"
66
description = "Wrapper around reqwest to allow for client middleware chains."
@@ -12,22 +12,24 @@ readme = "../README.md"
1212

1313
[features]
1414
multipart = ["reqwest/multipart"]
15-
json = ["reqwest/json"]
15+
json = ["reqwest/json", "dep:serde"]
1616
charset = ["reqwest/charset"]
1717
http2 = ["reqwest/http2"]
18-
rustls-tls = ["reqwest/rustls-tls"]
18+
rustls = ["reqwest/rustls"]
19+
query = ["reqwest/query", "dep:serde"]
20+
form = ["reqwest/form", "dep:serde"]
1921

2022
[dependencies]
2123
anyhow = "1.0.0"
2224
async-trait = "0.1.51"
2325
http = "1.0.0"
24-
reqwest = { version = "0.12.0", default-features = false }
25-
serde = "1.0.106"
26-
thiserror = "1.0.21"
26+
reqwest = { version = "0.13.1", default-features = false }
27+
serde = { version = "1.0.106", optional = true }
28+
thiserror = "2.0"
2729
tower-service = "0.3.0"
2830

2931
[dev-dependencies]
30-
reqwest = { version = "0.12.0", features = ["rustls-tls"] }
32+
reqwest = { version = "0.13.1", features = ["rustls"] }
3133
reqwest-retry = { path = "../reqwest-retry" }
3234
reqwest-tracing = { path = "../reqwest-tracing" }
3335
tokio = { version = "1.0.0", features = ["macros", "rt-multi-thread"] }

reqwest-middleware/src/client.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use http::Extensions;
22
use reqwest::header::{HeaderMap, HeaderName, HeaderValue};
33
use reqwest::{Body, Client, IntoUrl, Method, Request, Response};
4-
use serde::Serialize;
54
use std::convert::TryFrom;
65
use std::fmt::{self, Display};
76
use std::sync::Arc;
@@ -449,6 +448,7 @@ impl RequestBuilder {
449448
}
450449
}
451450

451+
#[cfg(feature = "query")]
452452
/// Modify the query string of the URL.
453453
///
454454
/// Modifies the URL of this request, adding the parameters provided.
@@ -467,13 +467,14 @@ impl RequestBuilder {
467467
/// # Errors
468468
/// This method will fail if the object you provide cannot be serialized
469469
/// into a query string.
470-
pub fn query<T: Serialize + ?Sized>(self, query: &T) -> Self {
470+
pub fn query<T: serde::Serialize + ?Sized>(self, query: &T) -> Self {
471471
RequestBuilder {
472472
inner: self.inner.query(query),
473473
..self
474474
}
475475
}
476476

477+
#[cfg(feature = "form")]
477478
/// Send a form body.
478479
///
479480
/// Sets the body to the url encoded serialization of the passed value,
@@ -501,7 +502,7 @@ impl RequestBuilder {
501502
///
502503
/// This method fails if the passed value cannot be serialized into
503504
/// url encoded format
504-
pub fn form<T: Serialize + ?Sized>(self, form: &T) -> Self {
505+
pub fn form<T: serde::Serialize + ?Sized>(self, form: &T) -> Self {
505506
RequestBuilder {
506507
inner: self.inner.form(form),
507508
..self
@@ -520,29 +521,13 @@ impl RequestBuilder {
520521
/// fail, or if `T` contains a map with non-string keys.
521522
#[cfg(feature = "json")]
522523
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
523-
pub fn json<T: Serialize + ?Sized>(self, json: &T) -> Self {
524+
pub fn json<T: serde::Serialize + ?Sized>(self, json: &T) -> Self {
524525
RequestBuilder {
525526
inner: self.inner.json(json),
526527
..self
527528
}
528529
}
529530

530-
/// Disable CORS on fetching the request.
531-
///
532-
/// # WASM
533-
///
534-
/// This option is only effective with WebAssembly target.
535-
///
536-
/// The [request mode][mdn] will be set to 'no-cors'.
537-
///
538-
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/Request/mode
539-
pub fn fetch_mode_no_cors(self) -> Self {
540-
RequestBuilder {
541-
inner: self.inner.fetch_mode_no_cors(),
542-
..self
543-
}
544-
}
545-
546531
/// Build a `Request`, which can be inspected, modified and executed with
547532
/// `ClientWithMiddleware::execute()`.
548533
pub fn build(self) -> reqwest::Result<Request> {

reqwest-retry/CHANGELOG.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,31 @@ All notable changes to this project will be documented in this file.
44
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

7-
## [Unreleased]
7+
## [0.9.1](https://github.com/TrueLayer/reqwest-middleware/compare/reqwest-retry-v0.9.0...reqwest-retry-v0.9.1) - 2026-02-05
8+
9+
### Fixed
10+
11+
- *(reqwest-retry)* drop instant by upgrading wasmtimer ([#254](https://github.com/TrueLayer/reqwest-middleware/pull/254))
12+
13+
### Other
14+
15+
- Set changelog version for last release ([#268](https://github.com/TrueLayer/reqwest-middleware/pull/268))
16+
17+
## [0.9.0] - 2026-01-07
18+
19+
### Changed
20+
21+
- Updated `reqwest` to `0.13`
22+
23+
## [0.8.0] - 2025-11-26
24+
25+
### Breaking Changes
26+
27+
- Updated `retry-policies` (re-exported as `reqwest_retry::policies`) to 0.5.
28+
29+
### Changed
30+
31+
- Updated `thiserror` to `2.0`
832

933
## [0.7.0] - 2024-11-08
1034

reqwest-retry/Cargo.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "reqwest-retry"
3-
version = "0.7.0"
3+
version = "0.9.1"
44
authors = ["Rodrigo Gryzinski <rodrigo.gryzinski@truelayer.com>"]
55
edition = "2018"
66
description = "Retry middleware for reqwest."
@@ -14,24 +14,23 @@ default = ["tracing"]
1414
tracing = ["dep:tracing"]
1515

1616
[dependencies]
17-
reqwest-middleware = { version = ">0.3.0, <0.5.0", path = "../reqwest-middleware" }
17+
reqwest-middleware = { version = "0.5", path = "../reqwest-middleware" }
1818

1919
anyhow = "1.0.0"
2020
async-trait = "0.1.51"
2121
futures = "0.3.0"
2222
http = "1.0"
23-
reqwest = { version = "0.12.0", default-features = false }
24-
retry-policies = "0.4"
25-
thiserror = "1.0.61"
23+
reqwest = { version = "0.13.1", default-features = false }
24+
retry-policies = "0.5"
25+
thiserror = "2.0"
2626
tracing = { version = "0.1.26", optional = true }
2727

2828
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
2929
hyper = "1.0"
3030
tokio = { version = "1.6.0", default-features = false, features = ["time"] }
3131

3232
[target.'cfg(target_arch = "wasm32")'.dependencies]
33-
parking_lot = { version = "0.11.2", features = ["wasm-bindgen"] } # work around https://github.com/tomaka/wasm-timer/issues/14
34-
wasm-timer = "0.2.5"
33+
wasmtimer = "0.4.3"
3534
getrandom = { version = "0.2.0", features = ["js"] }
3635

3736
[dev-dependencies]

reqwest-retry/src/middleware.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,7 @@ where
177177
#[cfg(not(target_arch = "wasm32"))]
178178
tokio::time::sleep(duration).await;
179179
#[cfg(target_arch = "wasm32")]
180-
wasm_timer::Delay::new(duration)
181-
.await
182-
.expect("failed sleeping");
180+
wasmtimer::tokio::sleep(duration).await;
183181

184182
n_past_retries += 1;
185183
continue;

reqwest-retry/src/retryable_strategy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use reqwest_middleware::Error;
77
/// A [`RetryableStrategy`] has a single `handler` functions.
88
/// The result of calling the request could be:
99
/// - [`reqwest::Response`] In case the request has been sent and received correctly
10-
/// This could however still mean that the server responded with a erroneous response.
11-
/// For example a HTTP statuscode of 500
10+
/// This could however still mean that the server responded with a erroneous response.
11+
/// For example a HTTP statuscode of 500
1212
/// - [`reqwest_middleware::Error`] In this case the request actually failed.
13-
/// This could, for example, be caused by a timeout on the connection.
13+
/// This could, for example, be caused by a timeout on the connection.
1414
///
1515
/// Example:
1616
///

0 commit comments

Comments
 (0)