From 09167d6a2b212a85669e5f68fccccaea6e74e12a Mon Sep 17 00:00:00 2001 From: Julian Popescu Date: Wed, 10 Jul 2024 11:53:10 +0200 Subject: [PATCH 1/3] Update reqwest to latest version ^0.12 --- examples/github/Cargo.toml | 2 +- examples/hasura/Cargo.toml | 2 +- examples/web/Cargo.toml | 2 +- graphql_client/Cargo.toml | 2 +- graphql_client_cli/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/github/Cargo.toml b/examples/github/Cargo.toml index 663fc0fc..a4d83f18 100644 --- a/examples/github/Cargo.toml +++ b/examples/github/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" anyhow = "1.0" graphql_client = { path = "../../graphql_client", features = ["reqwest-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..055bc3e2 100644 --- a/examples/hasura/Cargo.toml +++ b/examples/hasura/Cargo.toml @@ -9,7 +9,7 @@ anyhow = "1.0" graphql_client = { path = "../../graphql_client", features = ["reqwest-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..07988d1e 100644 --- a/examples/web/Cargo.toml +++ b/examples/web/Cargo.toml @@ -14,7 +14,7 @@ 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..f30b1c01 100644 --- a/graphql_client/Cargo.toml +++ b/graphql_client/Cargo.toml @@ -20,7 +20,7 @@ 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 } +reqwest-crate = { package = "reqwest", version = "^0.12", features = ["json"], default-features = false, optional = true } [features] default = ["graphql_query_derive"] diff --git a/graphql_client_cli/Cargo.toml b/graphql_client_cli/Cargo.toml index caee4ffb..75b86a33 100644 --- a/graphql_client_cli/Cargo.toml +++ b/graphql_client_cli/Cargo.toml @@ -12,7 +12,7 @@ name = "graphql-client" path = "src/main.rs" [dependencies] -reqwest = { version = "^0.11", features = ["json", "blocking"] } +reqwest = { version = "^0.12", features = ["json", "blocking"] } graphql_client = { version = "0.14.0", path = "../graphql_client", default-features = false, features = ["graphql_query_derive", "reqwest-blocking"] } graphql_client_codegen = { path = "../graphql_client_codegen/", version = "0.14.0" } clap = { version = "^3.0", features = ["derive"] } From bbe3c00e9bef3a5390cbf01daadbe0c546d47733 Mon Sep 17 00:00:00 2001 From: Julian Popescu Date: Wed, 10 Jul 2024 12:09:14 +0200 Subject: [PATCH 2/3] Add feature flag to enable reqwest11 --- graphql_client/Cargo.toml | 6 +++++- graphql_client/src/lib.rs | 5 ++++- graphql_client/src/reqwest.rs | 13 +++++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/graphql_client/Cargo.toml b/graphql_client/Cargo.toml index f30b1c01..d7c7eca6 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 } +reqwest11-crate = { package = "reqwest", version = "^0.11", features = ["json"], default-features = false, optional = true } reqwest-crate = { package = "reqwest", version = "^0.12", features = ["json"], default-features = false, optional = true } [features] default = ["graphql_query_derive"] +reqwest11 = ["reqwest11-crate", "reqwest11-crate/default-tls"] +reqwest11-rustls = ["reqwest11-crate", "reqwest11-crate/rustls-tls"] +reqwest11-blocking = ["reqwest11-crate/blocking"] reqwest = ["reqwest-crate", "reqwest-crate/default-tls"] -reqwest-rustls = ["reqwest-crate", "reqwest-crate/rustls-tls"] reqwest-blocking = ["reqwest-crate/blocking"] +reqwest-rustls = ["reqwest-crate", "reqwest-crate/rustls-tls"] diff --git a/graphql_client/src/lib.rs b/graphql_client/src/lib.rs index d4856fac..7f1061fb 100644 --- a/graphql_client/src/lib.rs +++ b/graphql_client/src/lib.rs @@ -26,7 +26,10 @@ pub use graphql_query_derive::*; #[cfg(any( feature = "reqwest", feature = "reqwest-rustls", - feature = "reqwest-blocking" + feature = "reqwest-blocking", + feature = "reqwest11", + feature = "reqwest11-rustls", + feature = "reqwest11-blocking" ))] pub mod reqwest; diff --git a/graphql_client/src/reqwest.rs b/graphql_client/src/reqwest.rs index 3541915e..5f9bb24d 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; + +#[cfg(all(feature = "reqwest11-crate", not(feature = "reqwest-crate")))] +use reqwest11_crate as reqwest; +#[cfg(feature = "reqwest-crate")] use reqwest_crate as reqwest; /// Use the provided reqwest::Client to post a GraphQL request. -#[cfg(any(feature = "reqwest", feature = "reqwest-rustls"))] +#[cfg(any( + feature = "reqwest", + feature = "reqwest-rustls", + feature = "reqwest11", + feature = "reqwest11-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 = "reqwest-blocking", feature = "reqwest11-blocking"))] pub fn post_graphql_blocking( client: &reqwest::blocking::Client, url: U, From 9bf762eecb5281c19616c6437779cef9fa4e23db Mon Sep 17 00:00:00 2001 From: Julian Popescu Date: Wed, 10 Jul 2024 16:49:20 +0200 Subject: [PATCH 3/3] Change reqwest to reqwest12 for fully versioned feature flags --- examples/github/Cargo.toml | 2 +- examples/hasura/Cargo.toml | 2 +- examples/web/Cargo.toml | 2 +- graphql_client/Cargo.toml | 8 ++++---- graphql_client/src/lib.rs | 8 ++++---- graphql_client/src/reqwest.rs | 14 +++++++------- graphql_client_cli/Cargo.toml | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/github/Cargo.toml b/examples/github/Cargo.toml index a4d83f18..36231b3c 100644 --- a/examples/github/Cargo.toml +++ b/examples/github/Cargo.toml @@ -6,7 +6,7 @@ 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.12", features = ["json", "blocking"] } prettytable-rs = "^0.7" diff --git a/examples/hasura/Cargo.toml b/examples/hasura/Cargo.toml index 055bc3e2..974d5c3b 100644 --- a/examples/hasura/Cargo.toml +++ b/examples/hasura/Cargo.toml @@ -6,7 +6,7 @@ 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.12", features = ["json", "blocking"] } diff --git a/examples/web/Cargo.toml b/examples/web/Cargo.toml index 07988d1e..ed5cb7e1 100644 --- a/examples/web/Cargo.toml +++ b/examples/web/Cargo.toml @@ -8,7 +8,7 @@ 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" diff --git a/graphql_client/Cargo.toml b/graphql_client/Cargo.toml index d7c7eca6..c0ab2350 100644 --- a/graphql_client/Cargo.toml +++ b/graphql_client/Cargo.toml @@ -21,13 +21,13 @@ serde_json = "1.0" # Optional dependencies graphql_query_derive = { path = "../graphql_query_derive", version = "0.14.0", optional = true } reqwest11-crate = { package = "reqwest", version = "^0.11", features = ["json"], default-features = false, optional = true } -reqwest-crate = { package = "reqwest", version = "^0.12", 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"] reqwest11 = ["reqwest11-crate", "reqwest11-crate/default-tls"] reqwest11-rustls = ["reqwest11-crate", "reqwest11-crate/rustls-tls"] reqwest11-blocking = ["reqwest11-crate/blocking"] -reqwest = ["reqwest-crate", "reqwest-crate/default-tls"] -reqwest-blocking = ["reqwest-crate/blocking"] -reqwest-rustls = ["reqwest-crate", "reqwest-crate/rustls-tls"] +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 7f1061fb..4c8563a2 100644 --- a/graphql_client/src/lib.rs +++ b/graphql_client/src/lib.rs @@ -24,12 +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 = "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 5f9bb24d..9d1cbd1e 100644 --- a/graphql_client/src/reqwest.rs +++ b/graphql_client/src/reqwest.rs @@ -2,17 +2,17 @@ use crate::GraphQLQuery; -#[cfg(all(feature = "reqwest11-crate", not(feature = "reqwest-crate")))] +#[cfg(all(feature = "reqwest11-crate", not(feature = "reqwest12-crate")))] use reqwest11_crate as reqwest; -#[cfg(feature = "reqwest-crate")] -use reqwest_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", feature = "reqwest11", - feature = "reqwest11-rustls" + feature = "reqwest11-rustls", + feature = "reqwest12", + feature = "reqwest12-rustls" ))] pub async fn post_graphql( client: &reqwest::Client, @@ -26,7 +26,7 @@ pub async fn post_graphql( } /// Use the provided reqwest::Client to post a GraphQL request. -#[cfg(any(feature = "reqwest-blocking", feature = "reqwest11-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 75b86a33..82d626b4 100644 --- a/graphql_client_cli/Cargo.toml +++ b/graphql_client_cli/Cargo.toml @@ -13,7 +13,7 @@ path = "src/main.rs" [dependencies] reqwest = { version = "^0.12", features = ["json", "blocking"] } -graphql_client = { version = "0.14.0", path = "../graphql_client", default-features = false, features = ["graphql_query_derive", "reqwest-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"] }