From ba59c953a760463dd1597572cfeaf4c63a7e3af0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Nov 2023 13:37:51 +0100 Subject: [PATCH] Upgrade `rocket` crate to 0.5.0-rc.4 version (#1205) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kai Ren --- juniper_rocket/CHANGELOG.md | 2 ++ juniper_rocket/Cargo.toml | 2 +- juniper_rocket/src/lib.rs | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/juniper_rocket/CHANGELOG.md b/juniper_rocket/CHANGELOG.md index 23673456..ba9539f3 100644 --- a/juniper_rocket/CHANGELOG.md +++ b/juniper_rocket/CHANGELOG.md @@ -11,6 +11,7 @@ All user visible changes to `juniper_rocket` crate will be documented in this fi ### BC Breaks - Switched to 0.16 version of [`juniper` crate]. +- Switched to 0.5.0-rc.4 version of [`rocket` crate]. ([#1205]) ### Added @@ -18,6 +19,7 @@ All user visible changes to `juniper_rocket` crate will be documented in this fi [#930]: /../../issues/930 [#968]: /../../pull/968 +[#1205]: /../../pull/1205 diff --git a/juniper_rocket/Cargo.toml b/juniper_rocket/Cargo.toml index 8ca4a31e..9be11605 100644 --- a/juniper_rocket/Cargo.toml +++ b/juniper_rocket/Cargo.toml @@ -20,7 +20,7 @@ exclude = ["/examples/", "/tests/", "/release.toml"] [dependencies] futures = "0.3.22" juniper = { version = "0.16.0-dev", path = "../juniper", default-features = false } -rocket = { version = "=0.5.0-rc.3", default-features = false } +rocket = { version = "=0.5.0-rc.4", default-features = false } serde_json = "1.0.18" # Fixes for `minimal-versions` check. diff --git a/juniper_rocket/src/lib.rs b/juniper_rocket/src/lib.rs index 231593e4..436b9a9f 100644 --- a/juniper_rocket/src/lib.rs +++ b/juniper_rocket/src/lib.rs @@ -6,7 +6,7 @@ use rocket::{ data::{self, FromData, ToByteUnit}, form::{error::ErrorKind, DataField, Error, Errors, FromForm, Options, ValueField}, http::{ContentType, Status}, - outcome::Outcome::{Failure, Forward, Success}, + outcome::Outcome, response::{self, content, Responder, Response}, Data, Request, }; @@ -307,7 +307,7 @@ where let is_json = match content_type { Some(("application", "json")) => true, Some(("application", "graphql")) => false, - _ => return Box::pin(async move { Forward(data) }).await, + _ => return Outcome::Forward((data, Status::UnsupportedMediaType)), }; Box::pin(async move { @@ -318,13 +318,13 @@ where let mut reader = data.open(limit); let mut body = String::new(); if let Err(e) = reader.read_to_string(&mut body).await { - return Failure((Status::InternalServerError, format!("{e:?}"))); + return Outcome::Error((Status::InternalServerError, format!("{e:?}"))); } - Success(GraphQLRequest(if is_json { + Outcome::Success(GraphQLRequest(if is_json { match serde_json::from_str(&body) { Ok(req) => req, - Err(e) => return Failure((Status::BadRequest, e.to_string())), + Err(e) => return Outcome::Error((Status::BadRequest, e.to_string())), } } else { GraphQLBatchRequest::Single(http::GraphQLRequest::new(body, None, None))