Skip to content

Commit

Permalink
fix(rocket): update rocket to v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
duskmoon314 committed Nov 29, 2023
1 parent b1bce35 commit 9494a53
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 22 deletions.
56 changes: 38 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions httpbin-rocket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ edition.workspace = true
anyhow = { workspace = true }
httpbin = { workspace = true }
infer = { workspace = true }
rocket = { version = "0.5.0-rc.3", features = ["json"] }
rocket_cors = "0.6.0-alpha2"
rocket = { version = "0.5.0", features = ["json"] }
rocket_cors = "0.6.0"
serde = { workspace = true }
serde_json = { workspace = true }
serde_qs = { workspace = true }
2 changes: 1 addition & 1 deletion httpbin-rocket/src/http_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Handler for Anything {
let body = match data.open(512.kibibytes()).into_bytes().await {
// TODO: Handle incomplete body
Ok(body) => body.into_inner(),
Err(_) => return Outcome::failure(Status::InternalServerError),
Err(_) => return Outcome::error(Status::InternalServerError),
};

let body_string = match String::from_utf8(body.clone()) {
Expand Down
2 changes: 1 addition & 1 deletion httpbin-rocket/src/request_inspection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'r> FromRequest<'r> for UserAgentHeader<'r> {
async fn from_request(request: &'r Request<'_>) -> rocket::request::Outcome<Self, Self::Error> {
match request.headers().get_one("User-Agent") {
Some(user_agent) => rocket::request::Outcome::Success(UserAgentHeader(user_agent)),
None => rocket::request::Outcome::Failure((
None => rocket::request::Outcome::Error((
rocket::http::Status::BadRequest,
anyhow::anyhow!("The incoming request does not have a User-Agent header"),
)),
Expand Down

0 comments on commit 9494a53

Please sign in to comment.