Skip to content

Commit

Permalink
Add reqwest-blocking feature
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The `reqwest` feature no longer enables reqwest's
`blocking` feature. Instead, that is controlled by a separate
`reqwest-blocking` flag.
  • Loading branch information
ramosbugs committed Feb 27, 2024
1 parent 9d8f11a commit da7d1c5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
27 changes: 26 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,40 @@ maintenance = { status = "actively-developed" }
default = ["reqwest", "rustls-tls"]
pkce-plain = []
native-tls = ["reqwest/native-tls"]
reqwest-blocking = ["reqwest/blocking"]
rustls-tls = ["reqwest/rustls-tls"]
timing-resistant-secret-traits = []

[[example]]
name = "github"
required-features = ["reqwest-blocking"]

[[example]]
name = "google"
required-features = ["reqwest-blocking"]

[[example]]
name = "google_devicecode"
required-features = ["reqwest-blocking"]

[[example]]
name = "letterboxd"
required-features = ["reqwest-blocking"]

[[example]]
name = "msgraph"
required-features = ["reqwest-blocking"]

[[example]]
name = "wunderlist"
required-features = ["reqwest-blocking"]

[dependencies]
base64 = "0.13"
thiserror = "1.0"
http = "0.2"
rand = "0.8"
reqwest = { version = "0.11", optional = true, default-features = false, features = ["blocking"] }
reqwest = { version = "0.11", optional = true, default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ mod introspection;

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

/// OAuth 2.0 Token Revocation implementation
Expand Down
4 changes: 2 additions & 2 deletions src/reqwest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ pub enum Error {
Io(#[from] std::io::Error),
}

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

pub use async_client::async_http_client;

#[cfg(not(target_arch = "wasm32"))]
#[cfg(all(feature = "reqwest-blocking", not(target_arch = "wasm32")))]
mod blocking {
use crate::reqwest::Error;
use crate::{HttpRequest, HttpResponse};
Expand Down

0 comments on commit da7d1c5

Please sign in to comment.