Upgrade rocket
crate to 0.5.0-rc.4 version (#1205)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kai Ren <tyranron@gmail.com>
This commit is contained in:
parent
d0f50e73e0
commit
ba59c953a7
3 changed files with 8 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue