Support latest rocket 0.4 (#940)

There was a regression:

https://github.com/SergioBenitez/Rocket/issues/1647

Fixes https://github.com/graphql-rust/juniper/issues/939.
This commit is contained in:
Christian Legnitto 2021-06-06 18:27:24 -04:00 committed by GitHub
parent d3896bd33c
commit 2cb026fe53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View file

@ -1,5 +1,6 @@
# master
- Minimum `rocket` version is now `0.4.9`. Note this also bumps the [minimum required `rustc` version](https://github.com/SergioBenitez/Rocket/blob/v0.4/CHANGELOG.md#version-048-may-18-2021).
- Compatibility with the latest `juniper`.
# [[0.6.3] 2021-04-03](https://github.com/graphql-rust/juniper/releases/tag/juniper_rocket-0.6.3)

View file

@ -13,7 +13,7 @@ repository = "https://github.com/graphql-rust/juniper"
[dependencies]
juniper = { version = "0.15.5", path = "../juniper", default-features = false}
rocket = { version = "0.4.2", default-features = false }
rocket = { version = "0.4.9", default-features = false }
serde_json = "1.0.2"
[dev-dependencies]

View file

@ -277,10 +277,10 @@ where
let mut body = String::new();
data.open()
.read_to_string(&mut body)
.map_err(|e| Err((Status::InternalServerError, format!("{:?}", e))))?;
.map_err(|e| (Status::InternalServerError, format!("{:?}", e)))?;
Success(GraphQLRequest(if is_json {
serde_json::from_str(&body).map_err(|e| Err((Status::BadRequest, format!("{}", e))))?
serde_json::from_str(&body).map_err(|e| (Status::BadRequest, format!("{}", e)))?
} else {
GraphQLBatchRequest::Single(http::GraphQLRequest::new(body, None, None))
}))