diff --git a/examples/github/Cargo.toml b/examples/github/Cargo.toml index 663fc0fc..36231b3c 100644 --- a/examples/github/Cargo.toml +++ b/examples/github/Cargo.toml @@ -6,9 +6,9 @@ edition = "2018" [dev-dependencies] anyhow = "1.0" -graphql_client = { path = "../../graphql_client", features = ["reqwest-blocking"] } +graphql_client = { path = "../../graphql_client", features = ["reqwest12-blocking"] } serde = "^1.0" -reqwest = { version = "^0.11", features = ["json", "blocking"] } +reqwest = { version = "^0.12", features = ["json", "blocking"] } prettytable-rs = "^0.7" clap = { version = "^3.0", features = ["derive"] } log = "^0.4" diff --git a/examples/hasura/Cargo.toml b/examples/hasura/Cargo.toml index 56ca334c..974d5c3b 100644 --- a/examples/hasura/Cargo.toml +++ b/examples/hasura/Cargo.toml @@ -6,10 +6,10 @@ edition = "2018" [dev-dependencies] anyhow = "1.0" -graphql_client = { path = "../../graphql_client", features = ["reqwest-blocking"] } +graphql_client = { path = "../../graphql_client", features = ["reqwest12-blocking"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -reqwest = { version = "^0.11", features = ["json", "blocking"] } +reqwest = { version = "^0.12", features = ["json", "blocking"] } prettytable-rs = "0.7.0" log = "0.4.3" env_logger = "0.5.10" diff --git a/examples/web/Cargo.toml b/examples/web/Cargo.toml index 76a0a292..ed5cb7e1 100644 --- a/examples/web/Cargo.toml +++ b/examples/web/Cargo.toml @@ -8,13 +8,13 @@ edition = "2018" crate-type = ["cdylib", "rlib"] [dependencies] -graphql_client = { path = "../../graphql_client", features = ["reqwest"] } +graphql_client = { path = "../../graphql_client", features = ["reqwest12"] } wasm-bindgen = "^0.2" serde = { version = "1.0.67", features = ["derive"] } lazy_static = "1.0.1" js-sys = "0.3.6" wasm-bindgen-futures = "0.4.18" -reqwest = "0.11.3" +reqwest = "0.12.5" [dependencies.web-sys] version = "0.3.6" diff --git a/graphql_client/Cargo.toml b/graphql_client/Cargo.toml index 76a57b7f..c0ab2350 100644 --- a/graphql_client/Cargo.toml +++ b/graphql_client/Cargo.toml @@ -20,10 +20,14 @@ serde_json = "1.0" # Optional dependencies graphql_query_derive = { path = "../graphql_query_derive", version = "0.14.0", optional = true } -reqwest-crate = { package = "reqwest", version = "^0.11", features = ["json"], default-features = false, optional = true } +reqwest11-crate = { package = "reqwest", version = "^0.11", features = ["json"], default-features = false, optional = true } +reqwest12-crate = { package = "reqwest", version = "^0.12", features = ["json"], default-features = false, optional = true } [features] default = ["graphql_query_derive"] -reqwest = ["reqwest-crate", "reqwest-crate/default-tls"] -reqwest-rustls = ["reqwest-crate", "reqwest-crate/rustls-tls"] -reqwest-blocking = ["reqwest-crate/blocking"] +reqwest11 = ["reqwest11-crate", "reqwest11-crate/default-tls"] +reqwest11-rustls = ["reqwest11-crate", "reqwest11-crate/rustls-tls"] +reqwest11-blocking = ["reqwest11-crate/blocking"] +reqwest12 = ["reqwest12-crate", "reqwest12-crate/default-tls"] +reqwest12-blocking = ["reqwest12-crate/blocking"] +reqwest12-rustls = ["reqwest12-crate", "reqwest12-crate/rustls-tls"] diff --git a/graphql_client/src/lib.rs b/graphql_client/src/lib.rs index d4856fac..4c8563a2 100644 --- a/graphql_client/src/lib.rs +++ b/graphql_client/src/lib.rs @@ -24,9 +24,12 @@ extern crate graphql_query_derive; pub use graphql_query_derive::*; #[cfg(any( - feature = "reqwest", - feature = "reqwest-rustls", - feature = "reqwest-blocking" + feature = "reqwest11", + feature = "reqwest11-rustls", + feature = "reqwest11-blocking", + feature = "reqwest12", + feature = "reqwest12-rustls", + feature = "reqwest12-blocking", ))] pub mod reqwest; diff --git a/graphql_client/src/reqwest.rs b/graphql_client/src/reqwest.rs index 3541915e..9d1cbd1e 100644 --- a/graphql_client/src/reqwest.rs +++ b/graphql_client/src/reqwest.rs @@ -1,10 +1,19 @@ //! A concrete client implementation over HTTP with reqwest. use crate::GraphQLQuery; -use reqwest_crate as reqwest; + +#[cfg(all(feature = "reqwest11-crate", not(feature = "reqwest12-crate")))] +use reqwest11_crate as reqwest; +#[cfg(feature = "reqwest12-crate")] +use reqwest12_crate as reqwest; /// Use the provided reqwest::Client to post a GraphQL request. -#[cfg(any(feature = "reqwest", feature = "reqwest-rustls"))] +#[cfg(any( + feature = "reqwest11", + feature = "reqwest11-rustls", + feature = "reqwest12", + feature = "reqwest12-rustls" +))] pub async fn post_graphql( client: &reqwest::Client, url: U, @@ -17,7 +26,7 @@ pub async fn post_graphql( } /// Use the provided reqwest::Client to post a GraphQL request. -#[cfg(feature = "reqwest-blocking")] +#[cfg(any(feature = "reqwest11-blocking", feature = "reqwest12-blocking"))] pub fn post_graphql_blocking( client: &reqwest::blocking::Client, url: U, diff --git a/graphql_client_cli/Cargo.toml b/graphql_client_cli/Cargo.toml index caee4ffb..82d626b4 100644 --- a/graphql_client_cli/Cargo.toml +++ b/graphql_client_cli/Cargo.toml @@ -12,8 +12,8 @@ name = "graphql-client" path = "src/main.rs" [dependencies] -reqwest = { version = "^0.11", features = ["json", "blocking"] } -graphql_client = { version = "0.14.0", path = "../graphql_client", default-features = false, features = ["graphql_query_derive", "reqwest-blocking"] } +reqwest = { version = "^0.12", features = ["json", "blocking"] } +graphql_client = { version = "0.14.0", path = "../graphql_client", default-features = false, features = ["graphql_query_derive", "reqwest12-blocking"] } graphql_client_codegen = { path = "../graphql_client_codegen/", version = "0.14.0" } clap = { version = "^3.0", features = ["derive"] } serde = { version = "^1.0", features = ["derive"] }