Skip to content

Commit 4193144

Browse files
author
Christoph Siedentop
committed
doctest: Fix regression after upgrade of reqwest to 0.10.
This was introduced in #350. Besides this, my thanks for upgrading reqwest. The old version cost me some time yesterday.
1 parent 9160417 commit 4193144

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ A typed GraphQL client library for Rust.
5959
```rust
6060
use graphql_client::{GraphQLQuery, Response};
6161
use std::error::Error;
62+
use reqwest;
6263

6364
#[derive(GraphQLQuery)]
6465
#[graphql(
@@ -68,14 +69,14 @@ A typed GraphQL client library for Rust.
6869
)]
6970
pub struct UnionQuery;
7071

71-
fn perform_my_query(variables: union_query::Variables) -> Result<(), Box<dyn Error>> {
72+
async fn perform_my_query(variables: union_query::Variables) -> Result<(), Box<dyn Error>> {
7273

7374
// this is the important line
7475
let request_body = UnionQuery::build_query(variables);
7576

7677
let client = reqwest::Client::new();
77-
let mut res = client.post("/graphql").json(&request_body).send()?;
78-
let response_body: Response<union_query::ResponseData> = res.json()?;
78+
let mut res = client.post("/graphql").json(&request_body).send().await?;
79+
let response_body: Response<union_query::ResponseData> = res.json().await?;
7980
println!("{:#?}", response_body);
8081
Ok(())
8182
}

graphql_client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ optional = true
4141
[dev-dependencies]
4242
# Note: If we bumpup wasm-bindge-test version, we should change CI setting.
4343
wasm-bindgen-test = "^0.3"
44+
reqwest = { version = "^0.10", features = ["json", "blocking"] }
4445

4546
[features]
4647
default = ["graphql_query_derive"]

0 commit comments

Comments
 (0)