Skip to content

Commit 4d08e49

Browse files
committed
Add feature to use reqwest with rustls rather than native-tls.
Currently, enabling the reqwest feature pulls in native-tls. This is annoying in a project that otherwise uses rustls. This change adds a new feature 'reqwest-rustls' that also adds the reqwest module, but using reqwest with rustls rather than native-tls.
1 parent 5c8ec75 commit 4d08e49

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
## Unreleased
99

1010
- The `variables_derives` now trims whitespace from individual derivation traits.
11+
- The new `reqwest-rustls` feature works like the `reqwest` feature but with
12+
`rustls` rather than `native-tls`.
1113

1214
## 0.10.0 - 2021-07-04
1315

graphql_client/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ serde_json = "1.0"
1717

1818
# Optional dependencies
1919
graphql_query_derive = { path = "../graphql_query_derive", version = "0.10.0", optional = true }
20-
reqwest = { version = "^0.11", features = ["json"], optional = true }
20+
reqwest-crate = { package = "reqwest", version = "^0.11", features = ["json"], default-features = false, optional = true }
2121

2222
[features]
2323
default = ["graphql_query_derive"]
24-
reqwest-blocking = ["reqwest/blocking"]
24+
reqwest = ["reqwest-crate", "reqwest-crate/default-tls"]
25+
reqwest-rustls = ["reqwest-crate", "reqwest-crate/rustls-tls"]
26+
reqwest-blocking = ["reqwest-crate/blocking"]

graphql_client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern crate graphql_query_derive;
2323
#[doc(hidden)]
2424
pub use graphql_query_derive::*;
2525

26-
#[cfg(any(feature = "reqwest", feature = "reqwest-blocking"))]
26+
#[cfg(any(feature = "reqwest", feature = "reqwest-rustls", feature = "reqwest-blocking"))]
2727
pub mod reqwest;
2828

2929
use serde::{Deserialize, Serialize};

graphql_client/src/reqwest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//! A concrete client implementation over HTTP with reqwest.
22
33
use crate::GraphQLQuery;
4+
use reqwest_crate as reqwest;
45

56
/// Use the provided reqwest::Client to post a GraphQL request.
6-
#[cfg(feature = "reqwest")]
7+
#[cfg(any(feature = "reqwest", feature = "reqwest-rustls"))]
78
pub async fn post_graphql<Q: GraphQLQuery, U: reqwest::IntoUrl>(
89
client: &reqwest::Client,
910
url: U,

0 commit comments

Comments
 (0)