Skip to content

Commit ba59c95

Browse files
Upgrade rocket crate to 0.5.0-rc.4 version (#1205)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kai Ren <[email protected]>
1 parent d0f50e7 commit ba59c95

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

juniper_rocket/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ All user visible changes to `juniper_rocket` crate will be documented in this fi
1111
### BC Breaks
1212

1313
- Switched to 0.16 version of [`juniper` crate].
14+
- Switched to 0.5.0-rc.4 version of [`rocket` crate]. ([#1205])
1415

1516
### Added
1617

1718
- `AsRef` and `AsMut` implementation for `GraphQLRequest` to its inner type. ([#968], [#930])
1819

1920
[#930]: /../../issues/930
2021
[#968]: /../../pull/968
22+
[#1205]: /../../pull/1205
2123

2224

2325

juniper_rocket/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ exclude = ["/examples/", "/tests/", "/release.toml"]
2020
[dependencies]
2121
futures = "0.3.22"
2222
juniper = { version = "0.16.0-dev", path = "../juniper", default-features = false }
23-
rocket = { version = "=0.5.0-rc.3", default-features = false }
23+
rocket = { version = "=0.5.0-rc.4", default-features = false }
2424
serde_json = "1.0.18"
2525

2626
# Fixes for `minimal-versions` check.

juniper_rocket/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rocket::{
66
data::{self, FromData, ToByteUnit},
77
form::{error::ErrorKind, DataField, Error, Errors, FromForm, Options, ValueField},
88
http::{ContentType, Status},
9-
outcome::Outcome::{Failure, Forward, Success},
9+
outcome::Outcome,
1010
response::{self, content, Responder, Response},
1111
Data, Request,
1212
};
@@ -307,7 +307,7 @@ where
307307
let is_json = match content_type {
308308
Some(("application", "json")) => true,
309309
Some(("application", "graphql")) => false,
310-
_ => return Box::pin(async move { Forward(data) }).await,
310+
_ => return Outcome::Forward((data, Status::UnsupportedMediaType)),
311311
};
312312

313313
Box::pin(async move {
@@ -318,13 +318,13 @@ where
318318
let mut reader = data.open(limit);
319319
let mut body = String::new();
320320
if let Err(e) = reader.read_to_string(&mut body).await {
321-
return Failure((Status::InternalServerError, format!("{e:?}")));
321+
return Outcome::Error((Status::InternalServerError, format!("{e:?}")));
322322
}
323323

324-
Success(GraphQLRequest(if is_json {
324+
Outcome::Success(GraphQLRequest(if is_json {
325325
match serde_json::from_str(&body) {
326326
Ok(req) => req,
327-
Err(e) => return Failure((Status::BadRequest, e.to_string())),
327+
Err(e) => return Outcome::Error((Status::BadRequest, e.to_string())),
328328
}
329329
} else {
330330
GraphQLBatchRequest::Single(http::GraphQLRequest::new(body, None, None))

0 commit comments

Comments
 (0)