Skip to content

Update reqwest to latest version ^0.12 #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/github/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions examples/hasura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions examples/web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 8 additions & 4 deletions graphql_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
9 changes: 6 additions & 3 deletions graphql_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
15 changes: 12 additions & 3 deletions graphql_client/src/reqwest.rs
Original file line number Diff line number Diff line change
@@ -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<Q: GraphQLQuery, U: reqwest::IntoUrl>(
client: &reqwest::Client,
url: U,
Expand All @@ -17,7 +26,7 @@ pub async fn post_graphql<Q: GraphQLQuery, U: reqwest::IntoUrl>(
}

/// 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<Q: GraphQLQuery, U: reqwest::IntoUrl>(
client: &reqwest::blocking::Client,
url: U,
Expand Down
4 changes: 2 additions & 2 deletions graphql_client_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down