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
|
### BC Breaks
|
||||||
|
|
||||||
- Switched to 0.16 version of [`juniper` crate].
|
- Switched to 0.16 version of [`juniper` crate].
|
||||||
|
- Switched to 0.5.0-rc.4 version of [`rocket` crate]. ([#1205])
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ All user visible changes to `juniper_rocket` crate will be documented in this fi
|
||||||
|
|
||||||
[#930]: /../../issues/930
|
[#930]: /../../issues/930
|
||||||
[#968]: /../../pull/968
|
[#968]: /../../pull/968
|
||||||
|
[#1205]: /../../pull/1205
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ exclude = ["/examples/", "/tests/", "/release.toml"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures = "0.3.22"
|
futures = "0.3.22"
|
||||||
juniper = { version = "0.16.0-dev", path = "../juniper", default-features = false }
|
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"
|
serde_json = "1.0.18"
|
||||||
|
|
||||||
# Fixes for `minimal-versions` check.
|
# Fixes for `minimal-versions` check.
|
||||||
|
|
|
@ -6,7 +6,7 @@ use rocket::{
|
||||||
data::{self, FromData, ToByteUnit},
|
data::{self, FromData, ToByteUnit},
|
||||||
form::{error::ErrorKind, DataField, Error, Errors, FromForm, Options, ValueField},
|
form::{error::ErrorKind, DataField, Error, Errors, FromForm, Options, ValueField},
|
||||||
http::{ContentType, Status},
|
http::{ContentType, Status},
|
||||||
outcome::Outcome::{Failure, Forward, Success},
|
outcome::Outcome,
|
||||||
response::{self, content, Responder, Response},
|
response::{self, content, Responder, Response},
|
||||||
Data, Request,
|
Data, Request,
|
||||||
};
|
};
|
||||||
|
@ -307,7 +307,7 @@ where
|
||||||
let is_json = match content_type {
|
let is_json = match content_type {
|
||||||
Some(("application", "json")) => true,
|
Some(("application", "json")) => true,
|
||||||
Some(("application", "graphql")) => false,
|
Some(("application", "graphql")) => false,
|
||||||
_ => return Box::pin(async move { Forward(data) }).await,
|
_ => return Outcome::Forward((data, Status::UnsupportedMediaType)),
|
||||||
};
|
};
|
||||||
|
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
|
@ -318,13 +318,13 @@ where
|
||||||
let mut reader = data.open(limit);
|
let mut reader = data.open(limit);
|
||||||
let mut body = String::new();
|
let mut body = String::new();
|
||||||
if let Err(e) = reader.read_to_string(&mut body).await {
|
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) {
|
match serde_json::from_str(&body) {
|
||||||
Ok(req) => req,
|
Ok(req) => req,
|
||||||
Err(e) => return Failure((Status::BadRequest, e.to_string())),
|
Err(e) => return Outcome::Error((Status::BadRequest, e.to_string())),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GraphQLBatchRequest::Single(http::GraphQLRequest::new(body, None, None))
|
GraphQLBatchRequest::Single(http::GraphQLRequest::new(body, None, None))
|
||||||
|
|
Loading…
Reference in a new issue