Skip to content

Commit da7d1c5

Browse files
committedFeb 27, 2024
Add reqwest-blocking feature
BREAKING CHANGE: The `reqwest` feature no longer enables reqwest's `blocking` feature. Instead, that is controlled by a separate `reqwest-blocking` flag.
1 parent 9d8f11a commit da7d1c5

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed
 

‎Cargo.toml

+26-1
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,40 @@ maintenance = { status = "actively-developed" }
1919
default = ["reqwest", "rustls-tls"]
2020
pkce-plain = []
2121
native-tls = ["reqwest/native-tls"]
22+
reqwest-blocking = ["reqwest/blocking"]
2223
rustls-tls = ["reqwest/rustls-tls"]
2324
timing-resistant-secret-traits = []
2425

26+
[[example]]
27+
name = "github"
28+
required-features = ["reqwest-blocking"]
29+
30+
[[example]]
31+
name = "google"
32+
required-features = ["reqwest-blocking"]
33+
34+
[[example]]
35+
name = "google_devicecode"
36+
required-features = ["reqwest-blocking"]
37+
38+
[[example]]
39+
name = "letterboxd"
40+
required-features = ["reqwest-blocking"]
41+
42+
[[example]]
43+
name = "msgraph"
44+
required-features = ["reqwest-blocking"]
45+
46+
[[example]]
47+
name = "wunderlist"
48+
required-features = ["reqwest-blocking"]
49+
2550
[dependencies]
2651
base64 = "0.13"
2752
thiserror = "1.0"
2853
http = "0.2"
2954
rand = "0.8"
30-
reqwest = { version = "0.11", optional = true, default-features = false, features = ["blocking"] }
55+
reqwest = { version = "0.11", optional = true, default-features = false }
3156
serde = { version = "1.0", features = ["derive"] }
3257
serde_json = "1.0"
3358
sha2 = "0.10"

‎src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ mod introspection;
440440

441441
/// HTTP client backed by the [reqwest](https://crates.io/crates/reqwest) crate.
442442
/// Requires "reqwest" feature.
443-
#[cfg(feature = "reqwest")]
443+
#[cfg(any(feature = "reqwest", feature = "reqwest-blocking"))]
444444
pub mod reqwest;
445445

446446
/// OAuth 2.0 Token Revocation implementation

‎src/reqwest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ pub enum Error {
1515
Io(#[from] std::io::Error),
1616
}
1717

18-
#[cfg(not(target_arch = "wasm32"))]
18+
#[cfg(all(feature = "reqwest-blocking", not(target_arch = "wasm32")))]
1919
pub use blocking::http_client;
2020

2121
pub use async_client::async_http_client;
2222

23-
#[cfg(not(target_arch = "wasm32"))]
23+
#[cfg(all(feature = "reqwest-blocking", not(target_arch = "wasm32")))]
2424
mod blocking {
2525
use crate::reqwest::Error;
2626
use crate::{HttpRequest, HttpResponse};

0 commit comments

Comments
 (0)
Please sign in to comment.