From 2cb026fe5307a2a73d3715fc05381ddeb49de300 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Sun, 6 Jun 2021 18:27:24 -0400 Subject: [PATCH] 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. --- juniper_rocket/CHANGELOG.md | 1 + juniper_rocket/Cargo.toml | 2 +- juniper_rocket/src/lib.rs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/juniper_rocket/CHANGELOG.md b/juniper_rocket/CHANGELOG.md index a1c0f279..6f10e2a0 100644 --- a/juniper_rocket/CHANGELOG.md +++ b/juniper_rocket/CHANGELOG.md @@ -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) diff --git a/juniper_rocket/Cargo.toml b/juniper_rocket/Cargo.toml index 9fa1be07..f0a6e3ff 100644 --- a/juniper_rocket/Cargo.toml +++ b/juniper_rocket/Cargo.toml @@ -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] diff --git a/juniper_rocket/src/lib.rs b/juniper_rocket/src/lib.rs index 56e3145e..e623480c 100644 --- a/juniper_rocket/src/lib.rs +++ b/juniper_rocket/src/lib.rs @@ -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)) }))